BIGINT date format in comparison

  • What is the best way to filter out records which has a orderdate column in bigint format ?

  • Can u give some more information? Perhaps add some samples to clarify your question?

    I assume you have a table with a column with datatype BIGINT. You use that column to store date-values, like the sample below.

    ID...BigINT_Date

    1.....20131210

    2.....20131211

    3.....20131212

    4.....20131213

    To filter the data is specific to the notation used to store the date value. If it is stored in yyyymmdd format (like my sample) you could just filter using the < and > comparison. If it is stored in a mmddyyyy format it will be more complicated. You first need to convert the value to a datetime datatype and then use the < and > comparison.

    But my assumption about your situation could be completely wrong, so please give us more information!!

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • Thanks a lot for the quick reply.

    My datetime is stored in UTC format.

    Eg. 1299781800000 ( GMT: Thu, 10 Mar 2011 18:30:00 GMT, Your time zone: 11/3/2011 00:00:00 GMT+5.5)

  • SQL Kidu (12/18/2013)


    What is the best way to filter out records which has a orderdate column in bigint format ?

    The [font="Arial Black"]BEST [/font]way to do this is to attack the root cause of the problem. Dates should never be stored as BIGINT. You would do well to fix the table and the code that uses it. That would prevent the current problem and all future problems with this column.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Yeah. Make sense. This one is creating lot of confusion.. Will see to it.

    Thanks BTW 🙂

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

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