You can do some cool things directly in tSQL using "WAITFOR" with "DELAY" or "TIME".
Example below...
use Northwind--for this example
IF Object_ID('tempdb..##NewCategories') is not null drop table ##NewCategories
Create Table ##NewCategories (CategoryID int, CreatedDate datetime)--This is the table being updated by the loop below
go
declare @iIDmin int,
@iIDmax int--variable to hold max ID in Table
Select @iIDmin = (Select top 1 CategoryID from Categories (nolock) order by CategoryID desc)
/*---------------------------------
Now we're ready to go!
*/----------------------------------
While 1=1--Forever....
begin
WAITFOR DELAY '00:00:30'--Wait one minute
IF @iIDmin <> (Select top 1 CategoryID from Categories (nolock) order by CategoryID desc)
Begin
Select @iIDmax = (Select top 1 CategoryID from Categories (nolock) order by CategoryID desc)
Insert ##NewCategories--Insert all new rows
Select CategoryID, getdate()
From Categories
Where CategoryID between @iIDMin + 1 and @iIDmax
select @iIDmin = @iIDmax--reset min value
END
END
Signature is NULL