SQL: A neat trick to create a SELECT-query which will include all the column names

For this one you’ll need to thank SQL Chick (Melissa Coates)
Based on here blog post:
http://www.sqlchick.com/entries/2014/2/1/shortcut-to-script-individual-columns-from-a-table-valued-function-in-ssms

Basically start building a basic SELECT-query with ‘Select *‘, then select it all (CTRL+A) and hit CTRL+SHIFT+Q to open up the Query Designer. Now you can easily copy/paste the query which it has generated for you and this one does include all the column names! 😉

Neat-trick-to-create-a-select-statement-which-includes-all-columns-handy








Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s