All
I have the following piece of code that sets the desired date ranges for a query.
dp_history.effective_dt>=dateadd(mm,-1,dateadd(dd,((datepart(dd,getdate())*-1)+1),getdate())) AND dp_history.effective_dt<= dateadd(dd,((datepart(dd,getdate())*-1)),getdate())
It seems that when the query is run, the time portion of the query is set to the time portion of the Getdate() function, thus if I run the query at 1200, I miss anything that was loaded prior to 1200 on the startdate. This also means anything loaded post 1200 on the enddate is also missed out. This adds up to some seven thousand rows of transactions - not too good.
Is there a way to force the start time to be midnight on the query date provided, and also the time to be 23:59:59 on the end date from the above query.
I hope this makes sense. Thanks in advance for any help you can provide.
Cheers
Gezza
I have the following piece of code that sets the desired date ranges for a query.
dp_history.effective_dt>=dateadd(mm,-1,dateadd(dd,((datepart(dd,getdate())*-1)+1),getdate())) AND dp_history.effective_dt<= dateadd(dd,((datepart(dd,getdate())*-1)),getdate())
It seems that when the query is run, the time portion of the query is set to the time portion of the Getdate() function, thus if I run the query at 1200, I miss anything that was loaded prior to 1200 on the startdate. This also means anything loaded post 1200 on the enddate is also missed out. This adds up to some seven thousand rows of transactions - not too good.
Is there a way to force the start time to be midnight on the query date provided, and also the time to be 23:59:59 on the end date from the above query.
I hope this makes sense. Thanks in advance for any help you can provide.
Cheers
Gezza