Jerry_Pang
asked on
How to create a schedule?
I have a table - history
with PK - id, datetime - Lastaccessed
I want to create a sybase event that will automatically delete old history which are 7 days old that will run everyday.
how will i test this if this works?
i tried to use the wizzard but it doest work when i try to change the date&time.
btw, im using sybase ADAnywhere.
can you give me a script? and to test if it works. thanx
with PK - id, datetime - Lastaccessed
I want to create a sybase event that will automatically delete old history which are 7 days old that will run everyday.
how will i test this if this works?
i tried to use the wizzard but it doest work when i try to change the date&time.
btw, im using sybase ADAnywhere.
can you give me a script? and to test if it works. thanx
ASKER
i mean
howto,
create event eventname as {
everyday at 01:00
delete MyTable
where dateadd( day, 7, last_accessed ) < getdate()
}
howto,
create event eventname as {
everyday at 01:00
delete MyTable
where dateadd( day, 7, last_accessed ) < getdate()
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
DId this help?
ASKER
yep. i forgot.
where datediff( day, last_accessed, getdate() ) > 7
or
delete MyTable
where dateadd( day, 7, last_accessed ) < getdate()
HTH
Namasi Navaretnam