views:

278

answers:

1

I am using SQL Server Management Studio.

I want to know the shortcuts for easily aligning the T-SQL Queries and codes in a beautiful format for easy readability and understandability.

Please Let me know how to align the code without using any SQL Server formatting / aligning tools.

Please do give your valuable tips to align the same, right now to align the code i mean to make the code right and left aligned i m using the TAB and SPACE BAR key which becomes very difficult when the length of code is increasing.

+1  A: 

I also find SQL Server Management Studio's lack of auto-formatting a bit frustrating, compared to the functions in Visual Studio.

Consider upgrading to the SQL Server 2008 toolset for a handful of its formatting features. One feature that stands out is that it 'remembers' where you had indented to in the previous line (not sure if this was a 2005 or 2008 feature).

Also consider some online SQL formatting tools:

Online code formatting saves an incredible amount of time. If your goal is to quickly format your code, it couldn't get much easier and quicker than copy/paste.

alt text

p.campbell
Thanks for your reply, but in am working in an Organization where i dont have a Internet Access and I cannot install any of the Tools I am expected to do the alignment as an when I write the code, Is there any other keyboard shortcut which could help me speed up my job?