Right Align Numeric Values in SQL Server Management Studio

In SQL Server Management Studio (SSMS) there is an option to Right Align Numeric Values when using 'Results to Text' (Ctrl + T) mode.

By default results are left aligned:

numeric_values_left_aligned

To change the default to right align numeric values in 'Results to Text' go to 'Tools' -> 'Options' -> 'Query Results' -> 'SQL Server' -> 'Results to Text':

numeric_values_right_align

Check the option 'Right align numeric values' and Click 'OK'.

Queries in new windows will have the default option to right align numeric values in results.

To change the option for the current query only without changing the default behavior, right click on the query editor area and choose 'Query Options':

numeric_values_right_align_query_option

In 'Results' -> 'Text'
Check the option 'Right align numeric values' and Click 'OK':

numeric_values_right_align_query_options_text

Right aligned numeric values can be easier to read than left aligned:

numeric_values_right_aligned

Only numeric values will be right aligned, and only in 'Results to Text', not in 'Results to Grid'.

If the post helped you, please share it:
Pin It

2 comments to Right Align Numeric Values in SQL Server Management Studio

  • Andios

    Thanks. This would be great.

    This did not work for me in SQL 2014. I did it over a table (my own database) with tinyint and int type. I tried from both Tools/Options and Query Options. I also toggled between default and the two settings. Those columns always keep left aligned. Ugly. I can't figure out why it did not work for me.

  • Andios

    Gotcha. Can't delete or update previous post. But there are the third place to change the settings from menu Query/Option... and I also had to to use the main menu or RMB menu to send results to Text. It did not work if results are sent to Grid.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">