20090227

Wonky and still logically incorrect

This is another result from the school of cut-and-paste polymorphism. The original IF statement checked for two items in an OR condition, explaining the apparent redundancy in the second IF - but not why anyone would check @@error twice and expect the same value...


IF (@@error <> 0)

BEGIN

IF @@error <> 0

BEGIN

Set @intResultCode = @@error

Set @chvResultText = 'Error when registering the Station/Date. ' +

(SELECT description from master..sysmessages where error = @intResultCode and msglangid = 1033)

END
END

Because @@ERROR is cleared and reset on each statement executed, check it immediately following the statement being verified, or save it to a local variable that can be checked later. Source: MSDN

No comments:

Post a Comment

Be nice... it's the only internet we have.

License & copyright

Creative Commons License
StinkySQL weblog and any related pages, including the weblog's archives are licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.