Automatically generate a SELECT statement in SQL Server Management Studio for a table example
By: Jeremy Kadlec
Overview
From your previous examples, I want to find out how to get SQL Server Management Studio (SSMS) to do the work for me. How can I have this tool generate a SELECT statement rather than typing out each of the columns?
Explanation
SQL Server Management Studio does have a simple means to automatically generate a SELECT statement from a single table. Let's follow the steps below:
Once you are in SQL Server Management Studio, right click on the table you which you would like to have the SELECT statement generated for. |
|
On the subsequent interface, select the 'Script Table as' option. |
|
On the subsequent interface, select the 'SELECT To' option. |
|
On the subsequent interface, select the 'New Query Editor Window' option. |
|
Below is a sample image of the SELECT code generated for a table. |
|