i need data previous day (sql server db) transferring other db (postgress), since data huge want transfer records 2 hr, mean run job 12 times day , each time transfer rec 2 hr, record transfered should not duplicate.
so need query can schedule run 12 times , transfer records 2 hours each.
declare @starthour datetime, @endhour datetime set @endhour = dateadd(hh,datediff(hh,0,getdate()),0) set @starthour = dateadd(hh,-2,@endhour) --the above make query work start , end on-the-hour --so can run time within 1 hour data --for 2 hours ending on previous hour select * whatever thedate between @starthour , @endhour
Comments
Post a Comment