Scenario
With SQL Server Management Studio you have the ability to do just about everything you can do using T-SQL commands. One problem with using the GUI is that it is difficult to remember everything you clicked on to reproduce the behavior a second time. Another issue is that most of what you do through the GUI is done immediately which may not always be the best scenario. How can I capture what SQL Server is doing so I can reproduce the behavior or run the commands at a later time.
Solution
A nice addition to SQL Server Management Studio is the ability to script out most of the commands and operations that you can do through the GUI. Let’s take a look at doing a database backup as an example. Continue reading SQL Server Management Studio scripting on TSQL commands