Really???
-
I'm reading a 790 line SQL sproc, a lot of poor coding peppered with extrainious begin/end statements. It starts early on with a "begin tran" lots of poor inserts and updates. Looks like SQL 2000 code, no try/catch logic, then the kicker: End IF @@ERROR <> 0 -- error statements using the first needed begin/end block Else Commit Tran End That was the first reference in the whole novel to @@ERROR! (Code created for Msft) :laugh: For those who don't know SQL, that "End" before the "IF" FORCES it to always try to Commit the transaction, no matter how many errors the user has hit by now.
-
I'm reading a 790 line SQL sproc, a lot of poor coding peppered with extrainious begin/end statements. It starts early on with a "begin tran" lots of poor inserts and updates. Looks like SQL 2000 code, no try/catch logic, then the kicker: End IF @@ERROR <> 0 -- error statements using the first needed begin/end block Else Commit Tran End That was the first reference in the whole novel to @@ERROR! (Code created for Msft) :laugh: For those who don't know SQL, that "End" before the "IF" FORCES it to always try to Commit the transaction, no matter how many errors the user has hit by now.
I have seen something like that. A big problem if it's in a high security thing.
return true;
-
I'm reading a 790 line SQL sproc, a lot of poor coding peppered with extrainious begin/end statements. It starts early on with a "begin tran" lots of poor inserts and updates. Looks like SQL 2000 code, no try/catch logic, then the kicker: End IF @@ERROR <> 0 -- error statements using the first needed begin/end block Else Commit Tran End That was the first reference in the whole novel to @@ERROR! (Code created for Msft) :laugh: For those who don't know SQL, that "End" before the "IF" FORCES it to always try to Commit the transaction, no matter how many errors the user has hit by now.
Sounds like it was written by someone who doesn't really know SQL. They are only worth keeping around if they can be trained to do it the right way. If they argue that their way is perfectly fine, then chuck them out the door.
Just because the code works, it doesn't mean that it is good code.