I have been using this code in Javascript but now would like to incorporate it into a stored procedure:
self.test.testId =
('00000' + self.test.adminTestId).slice(-5) + "-" +
('00000' + self.test.userTestId).slice(-5) + "-" +
('00' + self.test.sequence).slice(-2);
What I would like to do is to accomplish the same with:
DECLARE @TestId VARCHAR(50)
DECLARE @AdminTestId INT
DECLARE @UserTestId INT
DECLARE @Seq INT
Can anyone give me advice on how I can do padding and join these with "-" to go into @TestId