Datetime

  • Dear All,

    select opening_bal,authorised_date from t_period_value_balance

    where group_no ='CENVAT' and

    duty_type= 'BED' and

    register_type ='RG23A' and

    authorised_date <='2011-05-31'

    order by authorised_date

    Execution of this code does not retrive the below row

    opening_bal authorised_date

    17763123.00000000 2011-05-31 22:51:21.367

    What to do with the authorised_date coloumn to retrive the above row ??

    I'm working in SQL 2005 Standard Edition.

  • change authorised_date <='2011-05-31' to authorised_date <'2011-06-01'



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Thanks for instant reply.

    That is one I have in mind.

  • If you don't supply a time, it defaults to midnight (00:00:00.000). So the datetime that your comparing to is '2011-05-31 00:00:00.000' which is less than the datetime on the record that's not being pulled. That's why it's not working. If this is a variable, you can use the DateAdd() function to add one day to the selected date.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • drew.allen (9/13/2011)


    If you don't supply a time, it defaults to midnight (00:00:00.000). So the datetime that your comparing to is '2011-05-31 00:00:00.000' which is less than the datetime on the record that's not being pulled. That's why it's not working. If this is a variable, you can use the DateAdd() function to add one day to the selected date.

    Drew

    Thanks for reply.

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

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