Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How Data To be get deleted automatically?

Author  Topic 

rammohan
Posting Yak Master

212 Posts

Posted - 2009-09-14 : 05:50:58
Hi All,
i am having a table named tbl1, it will get loaded with thousands of records daily. now i want to flush the entire data for every 7 days periods. please suggest me a way at database side

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2009-09-14 : 06:03:44
quote:
flush the entire data for every 7 days periods

Please explain.
Do you what to TRUNCATE the table every 7 days? That is, have an empty table.
Do you what to retain 7 days worth of data?

You can schedule a job in SQL Agent to run once a week.
Go to Top of Page

rammohan
Posting Yak Master

212 Posts

Posted - 2009-09-14 : 06:07:09
i want to truncate the table for every 7 days

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-14 : 06:21:47
Shedule this query as a job to run for every 7 days

Truncate table your_table

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

rammohan
Posting Yak Master

212 Posts

Posted - 2009-09-14 : 06:34:54
is there any alternate way with triggers?

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-14 : 08:32:23
quote:
Originally posted by rammohan

is there any alternate way with triggers?

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN




What is wrong with a job?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -