I have a script with a bunch of statements and one of them is this.....
DELETE FROM TEMP_FII A WHERE WS_INSTANCE_ID IN (SELECT WS_INSTANCE_ID FROM TEMP_FII WHERE A.ID <> ID)
Clearly, what I'm trying to do here is insure that there WS_INSTANCE_ID is distinct within this table and I'm using that query to delete any duplicates.
It all works fine except in the case where there are no duplicates at which point I get the "Query Cancelled by User" message (from Query Tool ODBC). That would be all fine and dandy if it would just continue running the rest of the script but it bombs right there and wont finish.
Any ideas as to how to either:
1. Re-write that query so that it doesn't die if there are no duplicates.
2. Put some command in the script so that it will keep running even if this command dies.
I tried using an IF EXISTS but kept getting a syntax error so I'm thinking I can't do that (at least on our server or with the software/connection type that I'm using)
DELETE FROM TEMP_FII A WHERE WS_INSTANCE_ID IN (SELECT WS_INSTANCE_ID FROM TEMP_FII WHERE A.ID <> ID)
Clearly, what I'm trying to do here is insure that there WS_INSTANCE_ID is distinct within this table and I'm using that query to delete any duplicates.
It all works fine except in the case where there are no duplicates at which point I get the "Query Cancelled by User" message (from Query Tool ODBC). That would be all fine and dandy if it would just continue running the rest of the script but it bombs right there and wont finish.
Any ideas as to how to either:
1. Re-write that query so that it doesn't die if there are no duplicates.
2. Put some command in the script so that it will keep running even if this command dies.
I tried using an IF EXISTS but kept getting a syntax error so I'm thinking I can't do that (at least on our server or with the software/connection type that I'm using)