Within SQL Server Management Studio (SSMS) there is an option to automatically generate scripts for your changes done through the GUI. The solution for this problem is provided in SSMS and works with both SQL Server 2005 and SQL Server 2008, but by default this option that we will discuss is disabled.
To enable the option
After checking the specified checkbox, SSMS is now able to generate scripts for the creation and/or modification of any table when you use the designer.
Testing it out
Let's confirm the script generation for the creation of a new table.
Click on "Yes" to save the script and you will be prompted to specify the location. The file name by default will be the name of the table such as "tableName.sql", but this can be changed to anything you like.
If you do not want to save the script then click "No", clicking "No" will not roll back the implemented changes, but the script will not be saved
Notes:
It is important to mention here that unchecking the box in this frame as highlighted above "Automatically generate change script on every save" will cause this change to be undone in the options that we first configured.
Also scripts are not automatically generated for deletion of a table
While working on views through designers no script is generated, however the code for views operation is provided inside the designer and may be copied and saved.
By implementing script auto generation for your SSMS designer you will be able to save changes made through designers easily, which will allow you to have change scripts for changes made through SSMS designer
No comments:
Post a Comment