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 |
sachinsamuel
Constraint Violating Yak Guru
383 Posts |
Posted - 2007-08-08 : 10:13:30
|
Hi,I have created a temporary table, with a field as int. Then trying to insert charter in it. Its thowing me error which is very obvious. But I am not able to handle the error. Why is this? I think its a non fatal error and should be easily handled.Please help.---- Code startsCreate table #temp (Sid int)insert into #temp values ('A')If @@error>0 Print 'error occured'else print 'No error'-- code endDon't sit back because of failure. It will come back to check if you still available. -- Binu |
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2007-08-08 : 10:43:38
|
conversion errors like this abort the entire batch, not just the statement. that is why you cannot catch this error with @@error, since that statement never actually gets executed.Error handling in SQL2K is pretty poor. it is better in SQL2K5 though. You may want to read Erland Sommarskog's article on error handling for more info and sample code http://www.sommarskog.se/error-handling-I.html-ec |
 |
|
|
|
|