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 2000 Forums
 SQL Server Development (2000)
 capturing trace on error

Author  Topic 

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2004-11-03 : 12:04:07
i've got an alert setup on a db , which emails me on specified errors.
What I would actually like , is to be able to capture the trace on an error (I would then do something with this info, for debugging purposes). How is it possible to capture a trace when an error occurs, and make it generic for all sps (or does it have to be handled per stord procedure)?

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-11-03 : 22:15:49
per stored procedure

--------------------
keeping it simple...
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2004-11-04 : 02:02:29
Thanks, but how do you actually capture the trace info around the sp? As if I had SQL Profiler on.
This is opposed to capturing e.g Msg 281
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-11-04 : 02:42:34
in our case, when we upload the sproc for productions, we make sure there are no errors encountered, else we send out the error number by mail.

you should identify exactly what type of errors you expect.

or you could add an additional line that receives the statement to be processed next, so if the statement fails, you can send that line.

1 set @var='select field1 from table1'
2 select field1 from table1

so if there was a problem on line 2, send out the @var value by mail plus the error number or message.

--------------------
keeping it simple...
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2004-11-04 : 03:12:13
So, let's say I've got a web app, that is sending the line such as "exec mysp var1,var2,var3" , but the var3 is missing , this would throw an error on line1 , do you catch that one in the same way as suggested?
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-11-04 : 03:18:21
quote:
Originally posted by jackv

So, let's say I've got a web app, that is sending the line such as "exec mysp var1,var2,var3" , but the var3 is missing , this would throw an error on line1 , do you catch that one in the same way as suggested?



my style would to check if var3 is allowed to take nulls, then before executing anything on the sproc side, i'd check if all parameters are with values

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -