SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


BIGINT date format in comparison


BIGINT date format in comparison

Author
Message
SQL Kidu
SQL Kidu
SSC Veteran
SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)

Group: General Forum Members
Points: 202 Visits: 251
What is the best way to filter out records which has a orderdate column in bigint format ?
HanShi
HanShi
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8324 Visits: 3718
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’! **
SQL Kidu
SQL Kidu
SSC Veteran
SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)

Group: General Forum Members
Points: 202 Visits: 251
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)
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (206K reputation)SSC Guru (206K reputation)SSC Guru (206K reputation)SSC Guru (206K reputation)SSC Guru (206K reputation)SSC Guru (206K reputation)SSC Guru (206K reputation)SSC Guru (206K reputation)

Group: General Forum Members
Points: 206986 Visits: 41961
SQL Kidu (12/18/2013)
What is the best way to filter out records which has a orderdate column in bigint format ?


The BEST 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.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
SQL Kidu
SQL Kidu
SSC Veteran
SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)SSC Veteran (202 reputation)

Group: General Forum Members
Points: 202 Visits: 251
Yeah. Make sense. This one is creating lot of confusion.. Will see to it.

Thanks BTW Smile
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search