error handiling in bteq error

Database
N/A

error handiling in bteq error

hi

i am trying to write a bteq script which executes some select statements and exports the result to a text file on my system running on windows

here is the script

 .logtable SAMPLES.bteqexportLog;

.LOGON 127.0.0.1/tduser,tduser;

.begin export sessions 20;

.export outfile C:\Users\bhawuk_chauhan\Documents\teradataexportoutput.txt MODE RECORD FORMAT TEXT;

SELECT CAST(COUNT(*) as VARCHAR(100)) FROM SAMPLES.CustomerAddress12;

.IF ERRORCODE <> 0 THEN .GOTO ins

SELECT CAST(COUNT(*) as VARCHAR(100)) FROM SAMPLES.EmployeeAddress;

SELECT CAST(COUNT(*) as VARCHAR(100)) FROM SAMPLES.ProductCategory;

SELECT CAST(COUNT(*) as VARCHAR(100)) FROM SAMPLES.SalesPerson;

SELECT CAST(COUNT(*) as VARCHAR(100)) FROM SAMPLES.Store;

.LABEL ins

SELECT CAST(COUNT(*) as VARCHAR(100)) FROM SAMPLES.EmployeeAddress;

SELECT CAST(COUNT(*) as VARCHAR(100)) FROM SAMPLES.ProductCategory;

SELECT CAST(COUNT(*) as VARCHAR(100)) FROM SAMPLES.SalesPerson;

SELECT CAST(COUNT(*) as VARCHAR(100)) FROM SAMPLES.Store;.end export;

.logoff;

but i am getting error like this:

 UTY0006 Input error in the IF command at position 24: ".GOTO"

i have tried many other things but i am not able to get around this error

kindly help me regarding this

1 REPLY
Enthusiast

Re: error handiling in bteq error

Can't see anything wrong with the .IF or .GOTO syntax....

Can you try removing the space between the \ and teradataexportoutput.txt ??