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)
 Deleting a record

Author  Topic 

n_shankar_77
Starting Member

3 Posts

Posted - 2009-11-12 : 04:50:52
Hi,
i need to delete certain records after a particular time automatically say after 24 hours.how could i do this?
Thanks
Shankar.N

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-11-12 : 05:08:34
Hi try this once

delete from table where datediff(hh,datecolumn,getdate()) = 24
Go to Top of Page

n_shankar_77
Starting Member

3 Posts

Posted - 2009-11-12 : 05:11:00
Hi,
Thanks for the reply. But i need it to be done automatically something like how a trigger does.
Shankar.N
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2009-11-12 : 06:45:18
You can use a SQL job.

PBUH
Go to Top of Page

n_shankar_77
Starting Member

3 Posts

Posted - 2009-11-12 : 06:53:13
Hey,
I am new to SQL job can u help me in creating or send me some example links
Thanks
Shankar.N
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2009-11-12 : 07:38:57
You can google "create sql jobs in sql server 2005".

PBUH
Go to Top of Page
   

- Advertisement -