Home All Groups Group Topic Archive Search About

Error Handling not workinh after select a bad table

Author
13 Jul 2006 1:18 PM
sevlar
Hi guys,

I have a SP that is executing a simple task, and I´m forcing an error,
but the SQL Server is not catching the error, please help me.

The code is:

insert into table1
               select * from table2_bad

print @@error


Notes:
The table2_bad is not valid in the database, so the sql show an error
saying that the table isnt create of something... but the variable
@@error isnt filled.
Do you know why??

Thanks!

Author
13 Jul 2006 1:31 PM
SQL Menace
non trapable error, read this
http://www.sommarskog.se/error-handling-I.html
and
http://www.sommarskog.se/error-handling-II.html

Denis the SQL Menace
http://sqlservercode.blogspot.com/


sev***@gmail.com wrote:
Show quote
> Hi guys,
>
> I have a SP that is executing a simple task, and I´m forcing an error,
> but the SQL Server is not catching the error, please help me.
>
> The code is:
>
> insert into table1
>                select * from table2_bad
>
> print @@error
>
>
> Notes:
> The table2_bad is not valid in the database, so the sql show an error
> saying that the table isnt create of something... but the variable
> @@error isnt filled.
> Do you know why??
>
> Thanks!
Author
13 Jul 2006 1:36 PM
Alexander Kuznetsov
@@error would indicate a run time error. Because the code does not
compile, it does not execute.
Author
13 Jul 2006 1:52 PM
sevlar
So, there is any way to catch the compilation error?

I read the documents above, but i cant found any information on that.

Tks in advice.
Author
13 Jul 2006 2:53 PM
Arnie Rowland
Execute the code in a test environment and verify the results -or lack
thereof.

--
Arnie Rowland*
"To be successful, your heart must accompany your knowledge."



<sev***@gmail.com> wrote in message
Show quote
news:1152798776.654814.181530@h48g2000cwc.googlegroups.com...
> So, there is any way to catch the compilation error?
>
> I read the documents above, but i cant found any information on that.
>
> Tks in advice.
>

AddThis Social Bookmark Button