TSQL date syntax

  • In TSQL how would I set my WHERE clause to pull records with v.ApptDate in the past 3 months i.e. > (today-90 days) ?

    TIA

  • See the DateAdd and getdate functions

    dateadd( "d", -90, getdate() )

    dateadd( "mm", -3, getdate() ) etc.

  • Make sure you don't use a function on a column (bad for performance).

    Also please not that 90 days and 3 months are not the same thing .

  • Thanks guys!

    Sam

Viewing 4 posts - 1 through 3 (of 3 total)

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