I am trying to create a bteq script which run multiple Insert statements through sql file.
Supose i i have a file like abc.sql, In that i hv 10 Insert statements like
(Insert .... ;
now i run this file in Bteq using .RUN FILE abc.sql
my concern is if any of the insert statement failed for any reason (like syntactical issue ,spool issue,TDWM exception issue) the process will not stop and keep running till the last statement in the file. So if there is any 1 insrt failed still i hv 9 records in my table..
Any Suggestion will be helpful Thanks in Advance..
You might add .IF ERRORCODE <> 0 THEN .QUIT after each insert or .SET MAXERROR = 1; before .RUN FILE.
Both will stop after the first error.
If you want to run this as all or nothing you must add use a transaction:
.SET MAXERROR = 1;
I think the answer is the opposite (e.g.: default bteq behaviour). The OP wants the inserts NOT to stop on error...
the default in BTEQ is to ignore any error and go on with processing, only SQL Assistant stops by default :-)
Yep, I knew that ;-)
I misunderstood the OP. I thought he wanted NOT to stop the inserts.
If that's not the case, it may be worth to take a look at 'SET RETRY OFF' and 'SET REPEATSTOP ON' (in case of inserting rows from a file).
I have series of explain DDL statment in a bteq file ,when i run this file ,it errors out after explaining some DDL's