Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

If I am to add a new column to a table in SQL Server Management Studio 2008 via the interface/WYSIWYG (as opposed to writing a SQL query) this will, behind the scenes, create a SQL query which it will execute to perform the requested changes.

Is there any way to capture these SQL queries so that I am able to easily execute them on another server, without using SSMS, or re-writing the query.

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

When you make the changes, there's a menu option "Table Designer". Under there is the option to Generate a Change Script.

There's an option there to automatically generate the script on future changes too.

share|improve this answer
    
What dialog? When I click the save button, it just removes the "unsaved" asterisk from the current tab. –  Curt May 20 '13 at 12:39
    
mea culpa - brain still not working. I've updated my answer with the right answer. –  Thomas Rushton May 20 '13 at 12:42
1  
There is also a button that looks like a script with a floppy disk. If you hover over it, it should read 'Generate change script'. The button is part of the table designer toolbar. –  twoleggedhorse May 20 '13 at 12:46
    
Spot on! Found the menu option and toolbar option, exactly what I was after –  Curt May 20 '13 at 12:47
2  
The problem with the toolbar is that it mightn't be visible / showing. It's less likely that the menu option will be missing! –  Thomas Rushton May 20 '13 at 12:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.