I'm trying to create a simple table from external data that has problems with dates. The original data resides in MS Access, but I am exporting dates in a 10-char field as below.
I get: Failure 3707 Syntax error, expected something like ')' or ',' between the word 'Opened' and the 'cast' keyword.
What am I missing?
Should I be performing the cast in the using statement or the insert?
What is the corrcet syntax?
Very confused!!
Data format:
28304;2007-03-31;2008-01-15
80676;2007-12-31;2008-02-01
BTEQ script:
database dbname;
drop table dbname.storedt ;
create table dbname.storedt (
Outlet_ID varchar(10)
,Opened date
,Upgraded date
)
unique primary index (Outlet_ID);
.quiet on
.import vartext ';' file = filename.txt;
.repeat *
USING
Outlet_ID (varchar(10))
,Opened (date)
,Upgraded (date)
insert into dbname.storedt values
(:Outlet_ID
,:Opened (cast(Opened as date)
,:Upgraded (cast(Upgraded as date)
);
.logoff;
.quit;