Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL Justify

Author  Topic 

rwlopez
Yak Posting Veteran

80 Posts

Posted - 2006-11-07 : 13:21:35
Does anyone know if there is a way to right or left justify a column in a query? I need to do this for a text file export.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-07 : 13:23:58
Right aligned:
STR(somecolumn, columnwidth, decimals)
RIGHT(replicate(' ', 30) + somevarcharcolumn, 15)

Left aligned
LEFT(somevarcharcolumn + replicate(' ', 30), 15)


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -