March 11, 2006 at 1:56 am
Hi friends,
i m back after a long gap with a good question(i think so)..
Can we use errtrap in a sp to trap the errors which occurs inside it...Hope it can b done, So Guru's clarify my doubt with examples..
March 13, 2006 at 8:21 am
error trapping in TSQL is pretty limited;
if an error is level 16 or above(foreign key constraint violations, primary key, etc), they raise an error that cannot be trapped in TSQL, which is often the exact kind of errors you want to raise.
if you raise your own errorsthat are less than level 16, you could capture those, but that might not be all that helpful;
for example, you could test a value to see if it was less than zero, and then raise an error, but if you were going to raise an error, why wouldn't you just do the logic in the TSQL statement to resolve the issue.
SQL 20005 actually allows you to do try-catch statements or more robust error validation.
Lowell
March 14, 2006 at 1:51 am
Thanq lowell
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply