This is an easy one "Getdate"

  • Hello All,

    I need to compare system date to a date out of a table.  How can I compare the system date to the date_closed as shown below? Should I try to populate a variable using getdate?

    select * from jcjobm where job_stat <> 'A' and date_closed > THIS IS WHERE I NEED HELP "Today's date or getdate?" 

    Thanks,

    -NS

  • This will do the trick:

    select * from jcjobm where job_stat <> 'A' and date_closed > GETDATE()

     

  • getdate() will get you the exact minute. If you need everything from today, you'd need to calculate the current day minus the time,

    select datepart(mm,getdate() + '/' + datepart(d, getdate())...

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

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