Issues with loading date field using BTEQ script

Tools

Issues with loading date field using BTEQ script

Hi Guys,

I'm pretty new to BTEQ script. I was trying to load a table which has a date column but it's not being inserted properly.

I'm using the below code, this loads the data but the date column loads a s a float and not as a date field.

I've tried changing the date field to varchar and date format both in the script and table but it doesn't load it.

Can anyone tell me where I'm doing wrong?

--For creating table--

DROP TABLE play_pen.Stock_Clearance; 

CREATE MULTISET  TABLE play_pen.Stock_Clearance ,NO FALLBACK , 

     NO BEFORE JOURNAL

     NO AFTER JOURNAL

     CHECKSUM = DEFAULT 

     ( 

      Retail_outlet_number VARCHAR(4), 

      Base_Product_Number VARCHAR(8), 

      Launch_Date FLOAT

      Event  VARCHAR(9)    

      ) 

      ; 

---BTEQ Script---

.LOGON TDPM/UR77B,UR77B;

.IMPORT VARTEXT ',' FILE = 'D:\Displaced_Lines.txt'

.QUIET ON;

.REPEAT * PACK 5000;

USING 

RETAIL_OUTLET_NUMBER   (varchar(4)),

BASE_PRODUCT_NUMBER (varchar(8)),

LAUNCH_DATE (FLOAT),

EVENT (varCHAR(9))

INSERT INTO play_pen.Stock_Clearance

(              RETAIL_OUTLET_NUMBER ,

                BASE_PRODUCT_NUMBER ,

                LAUNCH_DATE ,

  EVENT

)

VALUES

     ( :RETAIL_OUTLET_NUMBER,

                :BASE_PRODUCT_NUMBER,

                :LAUNCH_DATE ,

                :EVENT

);

.quit;

Tags (2)
1 REPLY
Senior Apprentice

Re: Issues with loading date field using BTEQ script

- when you define VARTEXT all fields must be defined as VARCHAR in USING

- a FLOAT is a FLOAT and not a DATE