June 4, 2010 at 2:06 pm
Hi Everyone,
I have already set up snapshot replication. I want to filter the rows in the publication property.
we have last 2 years data in our tables what we are replicating. No we just want last 60 days data to replicate on the subscriber server just for reporting purpose.
Filter statement :
select <published_colums> From dbo.AgentQueueActivationHist where [ActivationDateTime] between '2010-04-06 07:45:11.000' and '2010-06-04 21:09:54.000'
i can get the data between last 60 days by writing above query.. but every time i have to change it to get the datetime... can anyone suggest me to find a better way to get the last 60 days data?
Mostly i have all the tables with datetime column it. Please suggest me a query to retrive recent 60days data with everyday snapshot replication. I am looking for a fixed solution, so i dont have to change the filter statement every time.
Thanks
June 11, 2010 at 2:48 am
select <published_colums> From dbo.AgentQueueActivationHist where [ActivationDateTime] >= getdate() - 60
June 12, 2010 at 11:54 am
Thanks Suresh.
That worked for me..
select <published_colums> From dbo.AgentQueueActivationHist where [ActivationDateTime] >= getdate() - 60
even we can do
select <published_colums> From dbo.AgentQueueActivationHist where [ActivationDateTime] >= dateadd(d, -60, getdate())
Thanks for the help
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply