Right-Align Text

Vishalneeraj-24503
Posted by Vishalneeraj-24503 under Sql Server category on | Points: 40 | Views : 1015
DECLARE @Header1 VARCHAR(25) = 'SQL Server Helper, LLC'
DECLARE @Header2 VARCHAR(25) = '1234 1st Street'
DECLARE @Header3 VARCHAR(25) = 'Somewhere City, NY 01001'
PRINT SPACE(50 - LEN(@Header1)) + @Header1
PRINT SPACE(50 - LEN(@Header2)) + @Header2
PRINT SPACE(50 - LEN(@Header3)) + @Header3


Output
---------------
SQL Server Helper, LLC
1234 1st Street
Somewhere City, NY 01001

Comments or Responses

Login to post response