Link to home
Start Free TrialLog in
Avatar of risky_analyst
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
Avatar of theartfuldazzler
theartfuldazzler
Flag of South Africa image

Hi

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

Avatar of risky_analyst
risky_analyst

ASKER

This was done by pass through
Anyone?
SOLUTION
Avatar of Dromame
Dromame

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial