I am trying to create an sp that will be put into a report that allows me to
pull information based on the last day to day year. E.g. today is 4/20/2005
and I would like to be able to pull info between 4/20/2004 and today, but I
want this to be dynamic so that it will pull the data tomorrow for 4/21/2004
to 4/21/2005where your_datetime_col between @.your_datetime_para and
dateadd(y,1,@.your_datetime_para)
-oj
"DBA" <DBA@.discussions.microsoft.com> wrote in message
news:50A09C7A-410D-4768-BC74-23D8D22516A0@.microsoft.com...
>I am trying to create an sp that will be put into a report that allows me
>to
> pull information based on the last day to day year. E.g. today is
> 4/20/2005
> and I would like to be able to pull info between 4/20/2004 and today, but
> I
> want this to be dynamic so that it will pull the data tomorrow for
> 4/21/2004
> to 4/21/2005|||SELECT
*
FROM <YourTable> WHERE <DateColumn> BETWEEN
DATEADD(YEAR, -1, GETDATE())
AND
GETDATE()
Hope it helps
Showing posts with label allows. Show all posts
Showing posts with label allows. Show all posts
Monday, March 19, 2012
Sunday, March 11, 2012
Date Formatting
How can I format the current date as yyyy-mm-dd and display it in a text box on the report. The FormatDateTime function only allows certain NamedFormat for the short and long dates but does not satisfy the above requirements. Any ideas?
=Format(Globals!ExecutionTime,"yyyy/MM/dd")
|||Thanks, it worked!
Subscribe to:
Posts (Atom)