|
I'm using try/catch to detect any errors in my script. If there are no errors then I would like to rename the table at the end of catch and if there are errors then I want to stop it in catch. But when I'm having problem with this. It is renaming the table regardless of errors. Is there any reason for this? I'm assuming try/catch runs the 'exec' statement regardless of errors.
(comments are locked)
|
|
If I understand what you want to do, then you could have a variable to indicate if there was an error. Then set it to True. If your variable is false, rename the table. In hasty psuedo-code it would look like:
(comments are locked)
|
|
You should leave the create table statement within the TRY part of the code, not the CATCH. It should only be going to the CATCH part of the code if there is an actual error. That's how it's meant to work. I am creating the table within the try part but I am renaming the table at the end. If there are errors then I don't want to rename the table.
Dec 10 '12 at 02:57 PM
liton
(comments are locked)
|
|
Thanks TimothyAWiseman. This is exactly what I was looking for.
(comments are locked)
|


Can you provide a sample of the code that you are working with please?