SQL Server: How do I generate the table schema and populate it with inserts in a script?
- by Paula DiTallo
Originally posted on: http://geekswithblogs.net/AskPaula/archive/2014/05/20/156469.aspx
In SSMS, there's a Generate Script utility (read: only available under version 2008 and up) .
Here are the steps you would need to take to make use of the utility:
Right click on the database you're interested in and go to Tasks -> Generate ScriptsSelect the tables and/or any other objects you'd like in order to get them into the script.Navigate to Set scripting options. Click on Advanced.Under the General category, navigate to Type of data to scriptSelect the Schema and Data option to get the insert statements generated. Click OK.