Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

Microsoft SQL Server 2008 R2 : SQL Server Management Studio - Development Tools (part 4)

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
3/26/2012 4:06:06 PM

T-SQL Debugging

Finally, you are able to debug T-SQL from within the SQL Server development environment. Yes, you could do this kind of thing using Visual Studio, but database developers should be able to debug in the environment where they generally develop their SQL statements—within SSMS. SQL Server 2008 provides this capability, and it works well.

The trickiest part of debugging may be starting the debugger. It is not all that difficult but may be less than obvious for some. For example, let’s say you want to debug a stored procedure. To do this, you right-click on the stored procedure in the Object Explorer and select Script Stored Procedure As, Execute To, New Query Editor Window, and a script for executing the procedure is generated. If the stored procedure has parameters, you add the SQL to assign a value to those parameters to the script. Now you are ready to debug this script and the related stored procedure.

To initiate debugging, you click on the green arrow on the SQL Server menu bar. When you start debugging, several new debugging windows are added to the SSMS display, and the query editor window shows a yellow arrow in the left margin next to the line in the script that is about to be run. You can now use the debug toolbar at the top of the SSMS screen to step through your code. If you click the Step Into button, the current statement executes, and the script progresses to the next available statement. Figure 12 shows an example of the T-SQL Debugging Environment while debugging is in progress. The debugging environment enables you to view values assigned to variables, review the call stack, set breakpoints, and perform debugging much like you would do in development environments such as Visual Studio.

Figure 12. The T-SQL Debugging Environment.

Multiserver Queries

Another slick new option available with SQL Server 2008 is the capability to execute a script on multiple servers at once. Multiserver queries allow the contents of a single query editor window to be run against all the servers defined in a given registered server group. After the group is created and servers are registered in the group, you can right-click on the group and select the New Query option to create a query window that can be run against all the servers in the group. Click on the Execute button, and the query is run against all the servers. Figure 13 shows a server group named MyTestGroup containing three servers registered in that group, a sample query to run against these servers, and a single result window that shows the results of the query for all servers in the group.

Figure 13. Multiserver query execution.

Multiserver queries are relatively easy to use. The results window includes a Server Name column that allows you to determine which server the result came from. These queries are backward compatible and allow you to run against prior versions of SQL Server, including SQL Server 2005. The only caveat is that you must first create a registered server group and the related registered servers before you run the query, but you already know that this task is also relatively easy.

Other -----------------
- Microsoft SQL Server 2008 R2 : SQL Server Management Studio - Development Tools (part 3) - Integrating SSMS with Source Control & Using SSMS Templates
- Sharepoint 2010 : Reviewing and Troubleshooting Crawls (part 2) - Using Crawl Reports & Diagnostic Logging
- Sharepoint 2010 : Reviewing and Troubleshooting Crawls (part 1) - Using Crawl Logs
- Sharepoint 2010 : Managing Crawls
- Microsoft Lync Server 2010 Monitoring : Installation (part 2) - Installing the Monitoring Server Role
- Microsoft Lync Server 2010 Monitoring : Installation (part 1) - Topology Builder for Microsoft Lync Server Monitoring Role
- Microsoft Lync Server 2010 Edge : Edge Troubleshooting
- Active Directory Domain Services 2008 : Enable a Computer Object
- Active Directory Domain Services 2008 : Disable a Computer Object
- Windows Server 2008 Server Core : Starting the Command Interpreter (part 5)
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server