Date comparison

  • I Have a Table called Orders I wanted to move all the order to next table.

    I use the below Query which takes the todays order as well.

    SELECT * FROM tbl_Order WHERE orderdate < GETDATE()

     

    I must use date condition. But if i run the aboe query at 1pm it will get todays and yesterdays records due to hh:mm:ss

    SELECT * FROM tbl_Order

    WHERE convert(varchar(50),orderdate,101) < convert(varchar(50),GETDATE(),101) 

    i have trind the convert but it various from servers like some time 107 or 105 or 101 i need permenant solution so which type can be used 101 or 105 or 107....

  • This page http://www.karaszi.com/SQLServer/info_datetime.asp will let you know all you could ever want to know about dates in sqlserver.



    Clear Sky SQL
    My Blog[/url]

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

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