tsinc
IS-IT--Management
- Oct 4, 2006
- 15
Hi Folks,
I am trying to add a SQL statement to a DTS job (run nightly) to just bring over data that populated an Oracle table the day before. I have a statement that does this between SQL db's, but using the same statement with Oracle is crapping out.
Statement as follows:
SELECT *
FROM table_name
WHERE datepart(dy,table_name.date_field) = datepart(dy,dateadd(dy,-1,GETDATE()))
The error I'm getting when parsing the statement is:
[Microsoft][ODBC driver for Oracle][Oracle]ORA-00904: "DATEPART":invalid identifier
The date format from the field I am querying is YYYY-MM-DD HH:MM:SS.
Any help is greatly appreciated ... thanks!!!
I am trying to add a SQL statement to a DTS job (run nightly) to just bring over data that populated an Oracle table the day before. I have a statement that does this between SQL db's, but using the same statement with Oracle is crapping out.
Statement as follows:
SELECT *
FROM table_name
WHERE datepart(dy,table_name.date_field) = datepart(dy,dateadd(dy,-1,GETDATE()))
The error I'm getting when parsing the statement is:
[Microsoft][ODBC driver for Oracle][Oracle]ORA-00904: "DATEPART":invalid identifier
The date format from the field I am querying is YYYY-MM-DD HH:MM:SS.
Any help is greatly appreciated ... thanks!!!