Massive Boisson
Massive Boisson

Reputation: 1627

SQL Server Mangement Studio Alter Script (2005)

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

Upvotes: 3

Views: 567

Answers (3)

marc_s
marc_s

Reputation: 755321

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

Upvotes: 1

Vijay Selvaraj
Vijay Selvaraj

Reputation: 145

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.

Upvotes: 2

Ben Wyatt
Ben Wyatt

Reputation: 409

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.

Upvotes: 2

Related Questions