datediff statement

  • Can you just code what you are asking for?

    Look:

    "hire date is greater then 90 days from today"

    can be easily traslated to:

    hire_date > dateadd(dd, -90, Getdate() )

    Why to complicate own life?

    _____________
    Code for TallyGenerator

  • Try this:

    SELECT * FROM myTable WHERE hire_date > (CONVERT(VARCHAR,getdate()-90, 110))

    - Tahsin

  • Worst suggestion.

    Never do like this.

    _____________
    Code for TallyGenerator

  • So what?

    "hire date is less then 90 days from today"

    can be easily traslated to:

    hire_date < dateadd(dd, -90, Getdate() )

    _____________
    Code for TallyGenerator

  • Thank You for the help. Hopefully I'll catch on to this T-SQL stuff quickly.

  • see anything wrong with this? just curious with the difference would be and why you chose dataadd over datediff

     

    where datediff(d,hire_date,GETDATE()) <= 90

     

    thanks!!!

  • This version makes using of indexes impossible.

    _____________
    Code for TallyGenerator

Viewing 7 posts - 1 through 8 (of 8 total)

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