views:

33

answers:

3

Hi. Is it possible to generated ALTER sql script from the changes you perform in Server Studio. This is possible in different tools for mysql, basically you get the log of executed statements. Is similar thing possible here, or how do you go about finding out what the modification (ALTER) script is?

Thanks.

-- MB

+1  A: 

If you're altering a table (by right-clicking and selecting Design, then there is a button named Generate Change Script on the Table Designer toolbar.

If you're talking about changes made in a properties window, there is a script button at the top of each of those that can generate scripts for changes you make through the UI.

Ben Wyatt
A: 

Not sure about SQL Server 2005, but in SQL Server Management Studio 2008 and later, you can definitely do this.

When you modify a table in the table designer (right-click on a table in your Object Explorer and pick "Design" from the menu), you can have SSMS generate the ALTER script for you by right-clicking in the designer and choosing "Generate Change Script":

A screenshot

marc_s
@Shog9: Thanks for pasting in that screenshot!
marc_s
A: 

You will be able to auto generate change scripts in SSMS. Take a look at this article, I believe it might be what you are looking for. http://www.mssqltips.com/tip.asp?tip=1723

from the article

As a part of my best practices, I always save the T-SQL scripts used for creation and modification of objects in SQL Server. When creating and modifying tables using SQL Server Management Studio designer it is easy to right click in the designer and select "Generate Change Script...", but is there a way to automatically script the creation and/or modification of tables made through of SQL Server Management Studio (SSMS) designer? This tip shows you an option that exists within SSMS to automatically generate these scripts for all table changes when using the table designer.

Vijay Selvaraj
Thanks, that's it
Massive Boisson