General information
Forum:
Microsoft SQL Server
You can try the REPLICATE function. Here is a sample where in this case the pad character is '0' and the overall length is 5.
SET @nextjobid = REPLICATE('0',5 - LEN(LTRIM(@nextjobid))) + LTRIM(@nextjobid)
HTH
John
>I have a varchar field that needs padding to allow proper ordering and checking for duplicates.
>
>Is there a command to pad zeroes onto a string?
>
>TIA
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only