How to right-align a text column - SQL Srv 2000

  • 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!

  • You could try to add spaces as a prefix, and then take the rightmost n characters, e.g.:

    selectright(space(10) + rtrim('hi'), 10)

    union all

    selectright(space(10) + rtrim('hello'), 10)

    The result is:

    ----------

    hi

    hello

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply