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.
Author |
Topic |
nucleox
Starting Member
2 Posts |
Posted - 2010-05-02 : 16:27:55
|
looks like there is an issue on some stored procedure I developed so I need to debug it, I was wondering if writing in a text file some entries when the SP is running it would be helpful, not sure, so if you can shed some light on this would be appreciated too. Let's say I choose to write down debugging log files, I should develop a specific stored proc or is there someone which I can use?thanks in advance, |
|
Kristen
Test
22859 Posts |
Posted - 2010-05-03 : 05:16:30
|
I find the syntax for the call to the Sproc (either by catching it from my application, using SQL Profiler, or similar), and then execute it:BEGIN TRANSACTIONEXEC MySproc @PARAM1='Foo', @PARAM2='Bar' , @intDebug=1ROLLBACK the transaction block ensures that if there is any update it is rolled back - so you can try again as many times as you need to.All our SProcs have @intDebug parameter which displays info when set. If I need to see more info to debug a problem I add more IF @intDebug > 1 statements ... which are then there for the future too.We also have a Logging Table in the database which the SProc can insert data into (if it needs to log "peculiar circumstances" during real time running etc. |
|
|
|
|
|