Search

Wednesday, September 14, 2011

Debug query in SSMS



In SQL Server 2008 its possible to debug queries in SQL Server Management Studio. It is very simple and easy.
In toolbar we have toolbar of Debug , if not we can open it as below



Now we will run below query in SQL Server Management Studio
DECLARE @I INT
SET @I = 1
WHILE @I <= 100
BEGIN
    PRINT @I
    SET @I = @I + 1
END     
Now start debugging as shown below

Open watch window as show below

Now create breakpoints in the query, by clicking at starting of the row.

Type Parameter @i in the Name field of watch window. Monitor the value of @i in the watch window.

Now I want to set its value to some new number.
See below how to modify it. Modify it and start debugging.


No comments:

Post a Comment