SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sql Server Timer Trigger
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sivakl_2001
Starting Member

Malaysia
4 Posts

Posted - 07/14/2010 :  05:08:31  Show Profile  Reply with Quote
hi i need to check a table(all rows) 1 mins once got update or not if not i need to remove the row
how to achive it

Kristen
Test

United Kingdom
22431 Posts

Posted - 07/14/2010 :  05:18:12  Show Profile  Reply with Quote
Scheduled task?

A "trigger" is only used when a record is Inserted, Update or Deleted - whereas a Scheduled Task is used for something that needs to run to a schedule - e.g. every minute.
Go to Top of Page

sql-programmers
Posting Yak Master

USA
190 Posts

Posted - 07/14/2010 :  05:48:33  Show Profile  Visit sql-programmers's Homepage  Reply with Quote
As per my assumption,

You can create a procedure with the update and delete statement based on your condition. Create a Job which calls your procedure and then schedule the job with some interval of time.

SQL Server Programmers and Consultants
http://www.sql-programmers.com/
Go to Top of Page

sivakl_2001
Starting Member

Malaysia
4 Posts

Posted - 07/14/2010 :  06:05:53  Show Profile  Reply with Quote
hi how can i check all rows in the trigger
for example i my table got Bit type column
i need to check the column for all row
if false remove that row
how to do this
Go to Top of Page

sivakl_2001
Starting Member

Malaysia
4 Posts

Posted - 07/14/2010 :  06:44:14  Show Profile  Reply with Quote
hi i created a table SysFTS with stime column(datetime)
this is my trigger
Create Trigger TestTrigger
on SysFTS
for update
as
Waitfor DELAY '00:00:59'
update sysfts set stime = getDAte()

i run the update query so the trigger fires
but inside the Trigger after 59 second again i update the Table
the Trigger supposed to be fire again right but didn't fire wats wrong in my Trigger
Go to Top of Page

Kristen
Test

United Kingdom
22431 Posts

Posted - 07/14/2010 :  07:01:31  Show Profile  Reply with Quote
A "trigger" is only used when a record is Inserted, Update or Deleted - whereas a Scheduled Task is used for something that needs to run to a schedule - e.g. every minute.
Go to Top of Page

sivakl_2001
Starting Member

Malaysia
4 Posts

Posted - 07/14/2010 :  21:04:21  Show Profile  Reply with Quote
quote:
Originally posted by sql-programmers

As per my assumption,

You can create a procedure with the update and delete statement based on your condition. Create a Job which calls your procedure and then schedule the job with some interval of time.

SQL Server Programmers and Consultants
http://www.sql-programmers.com/



can u tell me how to create simple job and how to schedule it
Go to Top of Page

Kristen
Test

United Kingdom
22431 Posts

Posted - 07/15/2010 :  02:01:59  Show Profile  Reply with Quote
In SSMS under the Server open up SQL Server Agent, right click JOBS and select NEW JOB.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000