dbTalk Databases Forums  

producing a date time report in SQL/DTS

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss producing a date time report in SQL/DTS in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Blasting Cap
 
Posts: n/a

Default producing a date time report in SQL/DTS - 12-28-2005 , 12:26 PM






I have need to produce a report (excel sheet actually) from SQL that
would run each Tuesday and each Friday of every week.

What needs to be on the Tuesday report is everything that came in from
the Friday midnight time, until the Monday midnight time. The friday
report(sheet) would have everything that came in from Midnight Monday
evening, thru midnight Thursday. The next Tuesday report would have
everything from Midnight Thursday thru midnight Monday, and so on.

I know I can schedule the jobs to run on that interval, but how do I
selectively pick the records I want? There is a datetime field on the
table, "submit date" and what I am basically doing is a select * from
tbl_literature_orders where date > x.

Any ideas?

Thanks,

BC

Reply With Quote
  #2  
Old   
Christian Donner
 
Posts: n/a

Default RE: producing a date time report in SQL/DTS - 12-28-2005 , 12:56 PM






"Blasting Cap" schrieb:
Quote:
I have need to produce a report (excel sheet actually) from SQL that
would run each Tuesday and each Friday of every week.

What needs to be on the Tuesday report is everything that came in from
the Friday midnight time, until the Monday midnight time. The friday
report(sheet) would have everything that came in from Midnight Monday
evening, thru midnight Thursday. The next Tuesday report would have
everything from Midnight Thursday thru midnight Monday, and so on.

I know I can schedule the jobs to run on that interval, but how do I
selectively pick the records I want? There is a datetime field on the
table, "submit date" and what I am basically doing is a select * from
tbl_literature_orders where date > x.

Any ideas?
Thanks,
BC
Try it with two jobs, one for Tuesday, one for Friday, and set the execution
time of the job appropriately. Search for your data by difference:
select * from MyTable where datefield > dateadd(d, -3, GetDate()) -- Friday
and
select * from MyTable where datefield > dateadd(d, -4, GetDate()) -- Tuesday


Reply With Quote
  #3  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: producing a date time report in SQL/DTS - 12-28-2005 , 01:13 PM



Just use the DATEPART() or DATENAME() functions to determine which day it
is. Then use DATEADD() with the appropriate days to get the from and to
that you need for your WHERE clause.

--
Andrew J. Kelly SQL MVP


"Blasting Cap" <goober (AT) christian (DOT) net> wrote

Quote:
I have need to produce a report (excel sheet actually) from SQL that would
run each Tuesday and each Friday of every week.

What needs to be on the Tuesday report is everything that came in from the
Friday midnight time, until the Monday midnight time. The friday
report(sheet) would have everything that came in from Midnight Monday
evening, thru midnight Thursday. The next Tuesday report would have
everything from Midnight Thursday thru midnight Monday, and so on.

I know I can schedule the jobs to run on that interval, but how do I
selectively pick the records I want? There is a datetime field on the
table, "submit date" and what I am basically doing is a select * from
tbl_literature_orders where date > x.

Any ideas?

Thanks,

BC



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.