Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to right-align a text column - SQL Srv 2000 Expand / Collapse
Author
Message
Posted Monday, December 03, 2007 4:22 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, December 05, 2007 3:44 AM
Points: 1, Visits: 18
Anybody has an idea on how to right align a text field (varchar or nvarchar) in SQL Server 2000? I wanna store an arabic text in the field, which is right-aligned!

Help please!
Post #428640
Posted Monday, December 03, 2007 5:41 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, January 26, 2012 5:26 AM
Points: 1,367, Visits: 1,585
You could try to add spaces as a prefix, and then take the rightmost n characters, e.g.:

select right(space(10) + rtrim('hi'), 10)
union all
select right(space(10) + rtrim('hello'), 10)

The result is:
----------
hi
hello

Regards,
Andras




Andras Belokosztolszki, MCPD, PhD
GoldenGate Software
Post #428675
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse