Re: Date comparison in SQL
Posted in 1994
robert/joe,
this will work, but you need to set the PATH variable to include the
$INFORMIXDIR and $INFORMIXDIR/bin..otherwise it wont run from cron.
>
> >From Joe Matuscak:
> *
> * Hi. Ive got a table that is used for logging information about when a
> * program is run. Among other things, its got a date field in it. Id like to
> * have my nightly cron job run some SQL that basically says "delete from
> * userlog where timestamp is older than 6 months". Can someone shed some
> * light on how to do that?
>
> Create a script called whatever you want it to be and put in it:
>
> isql db_name >/tmp/delete.log <<!
> delete from userlog where timestamp < ( TODAY - 180 );> !
>
> Robert Minter |Data Systems Support| \\\\\\_///
> Programmer, Software Development | Orange, CA | ( _ _ )
> internet: rob@dssmktg.com | Tel: 714.771.0454 | (| ^ |)
> bangpath: uunet.uu.net!dssmktg!rob| Fax: 714.771.3028 | \\`-'/
> #include <disclaimer.h> \\_/
>
--
regards,
+----------------------------------------------------------------------------+
| . . | |
| ... ... | Bob Baskett |
| ..... ..... | Software Engineer, DBA |
| .. ... .. | Business Systems Integration Group |
| . . . | Semiconductor Products Sector |
| | Mesa, AZ |
| Motorola, Inc. | |
|----------------------------------------------------------------------------|
| 'connectionLESS IS MORE' -- Data Broker |
|----------------------------------------------------------------------------|
| Duct tape is like the force. It has a light side, and a dark side, and |
| it holds the universe together ... |
| -- Carl Zwanzig |
+----------------------------------------------------------------------------+