2

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.

1 Answer 1

4

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.

5
  • What dialog? When I click the save button, it just removes the "unsaved" asterisk from the current tab.
    – Curtis
    May 20, 2013 at 12:39
  • mea culpa - brain still not working. I've updated my answer with the right answer. May 20, 2013 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. May 20, 2013 at 12:46
  • Spot on! Found the menu option and toolbar option, exactly what I was after
    – Curtis
    May 20, 2013 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! May 20, 2013 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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