Friday, February 24, 2012

Date enquiry

How would I do a datediff between the date within a record in the dataset
and an entered in parameter?
The following works in giving me the difference from the record to now...
but I need to change the now to the @.to parameter.
DATEDIFF([day], view.DATE, GETDATE()) AS noofdays
ThanksYou can pass the date parameter to the SP and then do the
DateDiff.
>--Original Message--
>How would I do a datediff between the date within a
record in the dataset
>and an entered in parameter?
>
>The following works in giving me the difference from the
record to now...
>but I need to change the now to the @.to parameter.
>
>DATEDIFF([day], view.DATE, GETDATE()) AS noofdays
>Thanks
>
>.
>|||DATEDIFF([day], view.DATE, CAST(@.to, datetime)) AS noofdays
"AshVsAOD" <.> wrote in message
news:%23UmDBoKkEHA.3896@.TK2MSFTNGP15.phx.gbl...
> How would I do a datediff between the date within a record in the dataset
> and an entered in parameter?
>
> The following works in giving me the difference from the record to now...
> but I need to change the now to the @.to parameter.
>
> DATEDIFF([day], view.DATE, GETDATE()) AS noofdays
> Thanks
>|||Thanks!
"D Lee" <dle@.d.com> wrote in message
news:e5jYN0nlEHA.3912@.TK2MSFTNGP12.phx.gbl...
> DATEDIFF([day], view.DATE, CAST(@.to, datetime)) AS noofdays
> "AshVsAOD" <.> wrote in message
> news:%23UmDBoKkEHA.3896@.TK2MSFTNGP15.phx.gbl...
> > How would I do a datediff between the date within a record in the
dataset
> > and an entered in parameter?
> >
> >
> > The following works in giving me the difference from the record to
now...
> > but I need to change the now to the @.to parameter.
> >
> >
> > DATEDIFF([day], view.DATE, GETDATE()) AS noofdays
> >
> > Thanks
> >
> >
>

No comments:

Post a Comment