Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to debug Stored procedure

Author  Topic 

santhosh.mm
Starting Member

2 Posts

Posted - 2008-03-08 : 12:07:24
Hi friends,

I am santhosh, working as a Sql developer.

I have created Stored Procedure in 200 lines.

After compilation its ok then created.

But the functionality is not good so how to debugging my stored procedure in step by step.

How to insert a break point.

I am using SQL server 2005.

I am not using any front end application like Dotnet using only SQL. (Front end department is different)

Please help me, line by line checking.


Advance Thanks,

Yours Santhosh.



Santhosh

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-03-08 : 12:13:38
YOu can't insert a break point.

You can use

PRINT 'xxxxx part is now done:' + cast(getdate() as varchar)

is now complete to see which part is slowing down.

Otherwise, you can post your code here to see if there are ways to improve what you have written.

Just that it compiles and creates a procedure doesn't mean it will work efficiently.

When you were creating it, did you test each component separately? (like does this statement provide the right results?, does this statement work as I need it to?)

Your debugging process should occur when you are creating the intended statements.





Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-03-08 : 12:17:51
Also, I am just guessing that this 200 line procedure has at least 1 cursor and dynamic SQL ?



Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

santhosh.mm
Starting Member

2 Posts

Posted - 2008-03-08 : 12:31:45
Dear Guru,

I am also using cursor....

quote:
Originally posted by dataguru1971

Also, I am just guessing that this 200 line procedure has at least 1 cursor and dynamic SQL ?



Poor planning on your part does not constitute an emergency on my part.





Santhosh
Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-03-08 : 12:33:18
I still can't diagnose your problem.

What is the SP actually doing?

Why are you using a cursor?

And again, there is no equivalent to the step by step debugging you might see in visual studio or VBA.



Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page
   

- Advertisement -