Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved scripts in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
By William Talada,
The first included script creates a procedure that displays a single row from a table vertically in alphabetical order with a column name and value in each row of the result set. This procedure is very handy when a table contains hundreds of columns ordered quite randomly. This will save you hours wasted per week simly trying to find a particular column in resultsets.
The second included script will do a standard "select" returning many rows but with all columns in alphabetical order. I haven't updated these to work with schemas other than the default one but most people are using dbo anyway.
To call these, supply a table name and a "where" clause as in the following example:
exec AzDisplay Customer, ''CustomerKey = 123'
exec AzSelect Customer, ''CustomerKey = 123'
My purpose in submitting these procedures is to show that key features are missing in SSMS that other products have such as dBASE and Sybase add-ons. One constant irritation for me in the SSMS Query window is the lack of commands in SQLCMD mode to control output directly such as having some result sets display as text and others as grids and others as vertical rows with or without headings and others with columns in alphabetical or type order.
How to display the columns of a table in alphabetical order in 2005 Management Studio?
How to iIncrement an alphabet by the next alphabet
A Union Query in Access 2003 produces the Sum of a Count, but Column cannot be ordered
Alter column order
Order by specific word, then aplhabetically