SQL String and number padded result

Creating a string and number padded result

 

SQL Server right and left padding

select right(replicate(‘0’,10)+cast(25695 as varchar(15)),10) as lpad_number

select left(cast(25695 as varchar(15))+replicate(‘0’,10),10) as rpad_number

Print Friendly

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *