Home > Archive > MS SQL Server > February 2006 > Is this a bug in SQL 2000/2005?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Is this a bug in SQL 2000/2005?
Florin Lazar

2006-02-28, 8:23 pm

Running the script below the error number is not generated and the
transaction is rolled back ...
Should be like this, or it should nicely give the error number and let me
decide what to do?
This is very usefull when using EXECUTE() or sp_executesql().

Here is hwo you can reproduce the problem:

CREATE TABLE xTest (IDCol int, xText varchar(100))

INSERT INTO xTest(IDCol,xText1) VALUES (1,'aaa')
SELECT @@ERROR --should be 207

DROP TABLE xTest
Tibor Karaszi

2006-02-28, 8:23 pm

Some errors terminates the batch. See the error handling articles at www.sommarskog.se for details.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/

Blog: http:// solidqualitylearning
.com/blogs/tibor/



"Florin Lazar" < FlorinLazar@discussi
ons.microsoft.com> wrote in message
news:A436FCDD-B959-42C6-965F- 4D40B47F6434@microso
ft.com...
> Running the script below the error number is not generated and the
> transaction is rolled back ...
> Should be like this, or it should nicely give the error number and let me
> decide what to do?
> This is very usefull when using EXECUTE() or sp_executesql().
>
> Here is hwo you can reproduce the problem:
>
> CREATE TABLE xTest (IDCol int, xText varchar(100))
>
> INSERT INTO xTest(IDCol,xText1) VALUES (1,'aaa')
> SELECT @@ERROR --should be 207
>
> DROP TABLE xTest


Gert-Jan Strik

2006-02-28, 8:23 pm

The batch does not compile, and thus it is never executed. So the line
"SELECT @@ERROR" will never be executed.

Gert-Jan


Florin Lazar wrote:
>
> Running the script below the error number is not generated and the
> transaction is rolled back ...
> Should be like this, or it should nicely give the error number and let me
> decide what to do?
> This is very usefull when using EXECUTE() or sp_executesql().
>
> Here is hwo you can reproduce the problem:
>
> CREATE TABLE xTest (IDCol int, xText varchar(100))
>
> INSERT INTO xTest(IDCol,xText1) VALUES (1,'aaa')
> SELECT @@ERROR --should be 207
>
> DROP TABLE xTest

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com