risky_analyst
asked on
teradata-numeric to date (query)
Hi I am using SAS with a teradata database. In my SQL statement, I am trying to write a WHERE statement querying only for certain date ranges. The date variable in the teradata datebase is numeric and is 6 digits. For example 82311 is August 23, 2011. Can someone help me with the syntax? Thanks
where CAST ( (CAST (run_date AS date FORMAT 'MMDDYY') ) AS CHAR(6)) >= 080111);
ERROR: Teradata row not delivered (trget): Invalid date supplied for
where CAST ( (CAST (run_date AS date FORMAT 'MMDDYY') ) AS CHAR(6)) >= 080111);
ERROR: Teradata row not delivered (trget): Invalid date supplied for
ASKER
This was done by pass through
ASKER
Anyone?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
How have you framed your SQl query. Is it a pss-thru query:
PROC SQL;
Connect to terabase(connection details);
select * from connection to terabase(
SQL query
);
quit;
or are you using libname access?
If you are using libname access, SAS should do the conversion for you, without the need for a CAST statement