Executing T-SQL with Run Selection


One of the features of the T-SQL stored procedure editor window that you might find especially helpful is the ability to execute arbitrary T-SQL code. As shown in Figure 5.12, you can create a "new stored procedure" to open a blank query window and enter whatever T-SQL you need to execute. Next, select one or more lines to execute, right-click, and choose "Run Selection". This executes the code (or tries to) and writes the output to the Database Output window (shown in Figure 5.11). This also means you can paste in or populate the T-SQL stored procedure editor from a batch file and execute the T-SQLincluding the GO separators.

Figure 5.12. Run Selection executes code from the stored procedure code editor.


Tip

Run Selection is available in Standard Edition or better.





Hitchhiker's Guide to Visual Studio and SQL Server(c) Best Practice Architectures and Examples
Hitchhikers Guide to Visual Studio and SQL Server: Best Practice Architectures and Examples, 7th Edition (Microsoft Windows Server System Series)
ISBN: 0321243625
EAN: 2147483647
Year: 2006
Pages: 227

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net