Exporting data In SQL Server as INSERT INTO
Exporting data In SQL Server as INSERT INTO
Exporting data In SQL Server as INSERT INTO
Re: Exporting data In SQL Server as INSERT INTO
In SSMS in the Object Explorer, right click on the database, right-click and pick "Tasks" and then "Generate Scripts".
This will allow you to generate scripts for a single or all tables, and one of the options is "Script Data". If you set that to TRUE, the wizard will generate a script with INSERT INTO () statement for your data.
**If using 2008 R2 or 2012 it is called something else, see screenshot below this one**
2008 R2 or later eg 2012
Select "Types of Data to Script" which can be "Data Only", "Schema and Data" or "Schema Only" - the default).
And then there's a "[SSMS Addin](https://github.com/jarrettv/DataScripter)" Package on Codeplex (including source) which promises pretty much the same functionality and a few more (like quick find etc.)
This will allow you to generate scripts for a single or all tables, and one of the options is "Script Data". If you set that to TRUE, the wizard will generate a script with INSERT INTO () statement for your data.
**If using 2008 R2 or 2012 it is called something else, see screenshot below this one**
2008 R2 or later eg 2012
Select "Types of Data to Script" which can be "Data Only", "Schema and Data" or "Schema Only" - the default).
And then there's a "[SSMS Addin](https://github.com/jarrettv/DataScripter)" Package on Codeplex (including source) which promises pretty much the same functionality and a few more (like quick find etc.)