Import date into a query in BTEQ

Teradata Applications

Import date into a query in BTEQ

Hi All,

I'm trying to run a BTEQ script with Date parameter. I want to import the date from a text file and the date is in yyyy-mm-dd format without single quotes.

Here is the script and the error. Can you please let me know where I'm going wrong.

.IMPORT data file= D:/BTEQ/SSW/date.txt
.QUIET ON
.REPEAT *
Using Ext(Date)

Delete from RTWIT_TDW_URT_EXCP.STG_SSW_MEMBR
where DWH_STT_DT = :Ext;

*** Starting Row 0 at Wed Aug 10 16:11:39 2011

*** Growing Buffer to 12338
*** Error: Import data size does not agree with byte length.
The cause may be:
1) IMPORT DATA vs. IMPORT REPORT
2) incorrect incoming data
3) import file has reached end-of-file.
*** Warning: Out of data.
*** Finished at Wed Aug 10 16:11:39 2011

Thank you,

Regards,
Ravi Challa
1 REPLY
Enthusiast

Re: Import date into a query in BTEQ

Change it to:

.IMPORT vartext file= D:/BTEQ/SSW/date.txt

And change the using clause to:

Using Ext (VARCHAR(10))

If you use "data" in the import clause, it thinks that the data is in Fastload format (not text format). Using VARTEXT tells it that it is brining in text (with a linefeed at the end of each record).