Date parameter

  • Hi all,

    I'm asking this again, but differently this time (no XML :))

    Here's my query, which prompts user for a date. I'd like to create something similar that runs again yesterday's date in the form of a sibscription. Can someone help with the code?

    Select u.Usetime, a.AccessCode, a.Name, u.VisualID

    From Usage u inner join AccessCodes a

    On u.AccessCode = a.AccessCode

    where

    ((a.AccessCode < '28')

    AND (u.VisualID Like '%251______%')

    AND (u.Usetime > @rdate)

    AND (u.Usetime < @rdate + 1))

    Order By u.VisualID ASC

  • The following will give you yesterday's date:

    In T-SQL

    DATEADD(dd,-1,GETDATE())

    In VB/SSRS

    =DATEADD("d",-1,NOW())

    HTH

    toolman

    [font="Comic Sans MS"]toolman[/font]
    [font="Arial Narrow"]Numbers 6:24-26[/font]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply