Solved

How to create a schedule?

Posted on 2003-10-27
5
581 Views
Last Modified: 2008-02-01
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
0
Comment
Question by:Jerry_Pang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:namasi_navaretnam
ID: 9631255
delete MyTable
where datediff( day, last_accessed, getdate() ) > 7

or

delete MyTable
where dateadd( day, 7, last_accessed ) < getdate()

HTH

Namasi Navaretnam

0
 
LVL 9

Author Comment

by:Jerry_Pang
ID: 9631778
i mean
howto,
create event eventname as {
everyday at 01:00

delete MyTable
where dateadd( day, 7, last_accessed ) < getdate()
}
0
 
LVL 15

Accepted Solution

by:
namasi_navaretnam earned 125 total points
ID: 9633277
Jerry,

CREATE EVENT DailyDelete
SCHEDULE DailyDelete
START TIME '1:00AM' EVERY 24 HOURS
HANDLER
   BEGIN
      delete MyTable
     where dateadd( day, 7, last_accessed ) < getdate()
   END

HTH
Namasi
0
 
LVL 15

Expert Comment

by:namasi_navaretnam
ID: 9655422
DId this help?
0
 
LVL 9

Author Comment

by:Jerry_Pang
ID: 9655580
yep. i forgot.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
truncation error - math operation 6 562
sybase license issue 6 561
SQL Time Syntax 4 311
Query: Was the data in the Table inserted in ascending order? 11 102
Facebook has became the #1 social media platform. People share many funny videos there, yet you don't know how to download them? Now you can download Videos from Facebook in just 3 simple steps.
After-hours service is a fact of life for most MSPs. While not the most pleasant aspect of the job, there are ways to make after-hours servicing a more profitable and organized enterprise.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question