BTEQ date import error

Tools & Utilities

BTEQ date import error

Hi All,

I have text file delimited with '|'.

emp_id|DOB(mm-dd-yyyy)|DOJ(dd/mm/yyyy)   *DOJ - Date of joining

101|12-25-1986|24/10/2008

102|01-23-1982|28/11/2006

.IMPORT VARTEXT '|' FILE=C:ABC.txt;

.REPEAT *

USING

emp_id (VARCHAR(3)),

emp_dob (VARCHAR(10)),

emp_doj (VARCHAR(10)),

INSERT INTO my_db.my_emp_tb

values

(

:emp_id,

:emp_dob,

:emp_doj

);

==> ERROR 2666 : Invalid date supplied.

Could anybody please tell me how to import these date formats?

It working fine with date format 'YYYY-MM-DD'.

Tags (1)
3 REPLIES
Junior Supporter

Re: BTEQ date import error

Try

INSERT INTO my_db.my_emp_tb

values

(

:emp_id,

CAST(:emp_dob AS DATE FORMAT 'MM-DD-YYYY'),

CAST(:emp_doj AS DATE FORMAT 'DD/MM/YYYY')

);

HTH.

Cheers.

Carlos.

Re: BTEQ date import error

Thanks Carlos.

Its working perfect.

Enthusiast

Re: BTEQ date import error

insert into my_db.my_emp_tb values(:empid,:emp_dob(format 'mm-dd-yyyy'),:emp_doj(format 'dd/mm/yyyy');