General information
Forum:
Microsoft SQL Server
>Hi folks!
>
>is there any example that describe Padding function for string/varchar
>similar to RPAD or LPAD function in Oracle?
>
>TIA
I just do this:
-- Pad left, length of 50, with spaces
RIGHT(space(50)+@myfield,50)
-- Pad left, length of 50, with zeros
RIGHT(replicate('0',50)+@myfield,50)
For padr you can do the same thing but use the left() function. I guess you could write UDF's to do this now.
BOb
Previous
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