I noticed some funny behaviour in a business application i support, it turne
d
out it was caused by a conversion error.
Essentially this code emmulates my problem:
PRINT 'Start'
PRINT CONVERT(int,'a')
PRINT 'End'
This code will yield the following result:
Start
Server: Msg 245, Level 16, State 1, Line 2
Syntax error converting the varchar value 'a' to a column of data type int.
In other words the conversion attempt stops execution of the script, despite
error 245 only being a severity 16 error. Does anyone else get this problem?
Suggestions?Some datatype conversion errors will terminate the batch, that is true. Ther
e is no setting that
will change it. Code defensively and check for this in the code so it doesn'
t happen. Also see the
error handling articles at www.sommarskog.se.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"sbt" <sbt@.discussions.microsoft.com> wrote in message
news:36C8E4B5-9282-4207-92B2-868D7755ADDE@.microsoft.com...
>I noticed some funny behaviour in a business application i support, it turn
ed
> out it was caused by a conversion error.
> Essentially this code emmulates my problem:
> PRINT 'Start'
> PRINT CONVERT(int,'a')
> PRINT 'End'
> This code will yield the following result:
> Start
> Server: Msg 245, Level 16, State 1, Line 2
> Syntax error converting the varchar value 'a' to a column of data type int
.
> In other words the conversion attempt stops execution of the script, despi
te
> error 245 only being a severity 16 error. Does anyone else get this proble
m?
> Suggestions?|||sbt
Wait for SQL Server 2005 to be used
BEGIN TRY
CATCH......
END TRY
"sbt" <sbt@.discussions.microsoft.com> wrote in message
news:36C8E4B5-9282-4207-92B2-868D7755ADDE@.microsoft.com...
> I noticed some funny behaviour in a business application i support, it
turned
> out it was caused by a conversion error.
> Essentially this code emmulates my problem:
> PRINT 'Start'
> PRINT CONVERT(int,'a')
> PRINT 'End'
> This code will yield the following result:
> Start
> Server: Msg 245, Level 16, State 1, Line 2
> Syntax error converting the varchar value 'a' to a column of data type
int.
> In other words the conversion attempt stops execution of the script,
despite
> error 245 only being a severity 16 error. Does anyone else get this
problem?
> Suggestions?|||Ye, having a background as a C++ programmer, I'm really missing proper
exception handling, however the database server is not likely to be upgraded
any time soon, so sadly thats not an option.
"Uri Dimant" skrev:
> sbt
> Wait for SQL Server 2005 to be used
> BEGIN TRY
> CATCH......
> END TRY
>
> "sbt" <sbt@.discussions.microsoft.com> wrote in message
> news:36C8E4B5-9282-4207-92B2-868D7755ADDE@.microsoft.com...
> turned
> int.
> despite
> problem?
>
>
Sunday, February 19, 2012
Error 245 terminates execution
Labels:
application,
behaviour,
business,
caused,
code,
conversion,
database,
emmulates,
error,
essentially,
execution,
funny,
microsoft,
mysql,
oracle,
server,
sql,
terminates,
turnedout
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment