Thursday, 30 January 2014

Generating change scripts in SQL Server

I have seen many times that developers do modification in database using VisualDesigner and struggle later on with providing scripts to other people (in case of local server). Modifying the Table structure and similar things are tasks that should be taken seriously and it might be hard to write the code remembering all the DDL statements. Specially when we have such a nice Designer provided by Microsoft who wants to get dirty by writing the code.

How to Generate Change Script:
In SSMS(Sql Server Management Studio) goto Tools -> Options.

In popup that got opened goto Designers -> Auto Generate Change Scripts.

Select the checkbox against it and you have sucessfully configured your sql server to generate the change script automatically.

NOTE: Sql Server will not generate any change script for Drop Table. ;-)