Last Full Month
Hello, I'm trying to write a MS-DTS Script that will connect to my Oracle 8i server and download data for the last full month.
In my Table I have a table "SW_CASE" I have a column named: "SWDATECREATED".
It store the data the following way:
What I need is a way to tell it I Only need the rows from the last full month. I don't want to have to change the date every time I co to run this query.
I've tried the following only to get a syntax error:
SW_CASE."SWDATECREATED" >= DATEADD(mm,DATEDIFF(mm,0,SYSDATE())-1,0) AND
SW_CASE."SWDATECREATED" < DATEADD(mm,DATEDIFF(mm,0,SYSDATE()),0))
You'll need to mess around with add_months and trunc. It will be something like add_months(trunc(sysdate,'mm'),-1) to trunc(sysdate,'mm')-1
Worked like a charm.
Thanks Jeff, It works!
Click Here to Expand Forum to Full Width