Good morning all -
I need to run a report against the previous full w... for example,
today the report should run for dates from 6-18-2006 to 6-24-2006.
I have found code that will tell me the previous Saturday and could
just subtract 7 days from that, but I am wondering if there isn't some
more elegant way using the various datepart functions.
Thanks-
Daniellejust added here :)
http://omnibuzz-sql.blogspot.com/20...l.blogspot.com/|||Have you considered using a calendar table?
Why should I consider using an auxiliary calendar table?
http://www.aspfaq.com/show.asp?id=2519
AMB
"wxbuff@.aol.com" wrote:
> Good morning all -
> I need to run a report against the previous full w... for example,
> today the report should run for dates from 6-18-2006 to 6-24-2006.
> I have found code that will tell me the previous Saturday and could
> just subtract 7 days from that, but I am wondering if there isn't some
> more elegant way using the various datepart functions.
> Thanks-
> Danielle
>|||Hi There
You may want to try this
declare @.d datetime
set @.d=getdate()
Select convert(varchar,dateadd(d,-6-datepart(dw,@.d),@.d),103),
convert(varchar,dateadd(d,-datepart(dw,@.d),@.d),103)
With Warm regards
Jatinder Singh
http://jatindersingh.blogspot.com
Alejandro Mesa wrote:
> Have you considered using a calendar table?
> Why should I consider using an auxiliary calendar table?
> http://www.aspfaq.com/show.asp?id=2519
>
> AMB
> "wxbuff@.aol.com" wrote:
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment