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.
![toGenerateSelectStatement 1](/tutorialImages/16_AutoGenerateSelectStatement_1.jpg)
On the subsequent interface, select the 'Script Table as' option.
![toGenerateSelectStatement 2](/tutorialImages/16_AutoGenerateSelectStatement_2.jpg)
On the subsequent interface, select the 'SELECT To' option.
![toGenerateSelectStatement 3](/tutorialImages/16_AutoGenerateSelectStatement_3.jpg)
On the subsequent interface, select the 'New Query Editor Window' option.
![toGenerateSelectStatement 4](/tutorialImages/16_AutoGenerateSelectStatement_4.jpg)
Below is a sample image of the SELECT code generated for a table.
![toGenerateSelectStatement 5](/tutorialImages/16_AutoGenerateSelectStatement_5.jpg)