Is this possible to debug the query in SQL Server 2005. I have heard about debugging support in SQL Server 2008. Also about debugging of stored procedures, but not about queries yet.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As far as I know, you have to have some kind of TSQL object in the database to debug to accomplish this. Since an ad hoc query doesn’t directly correlate to a server object, there is nothing to point the debugger at. There also might be a small big of setup involved before you can actually start debugging those objects.
However, it if fairly easy to wrap sql statements into a procedure just for the sake of debugging if you have the proper rights. It would not be a good idea to do on a production server, but if you do not have stored procedure creation rights, you might still be able to create a global temporary stored procedure, solely for debugging purposes.
Examples:
–SQL wrapped in procedure just so it can be debugged
CREATE PROCEDURE TestProcedure –(or ##testprocedure for global temp procedure)
AS
DECLARE @test DATETIME
SELECT @test = GetDate()
SELECT @test
Article illustrating some sql debugging info and examples in use – link.