james_lankford
Well-known Member
- Joined
- Jan 11, 2009
- Messages
- 1,223
We are using a database that is on sql server.
We didn't make the database.
It is part of a product we bought.
We have no rights to change any part of design in the database, or create tables or anything else.
I can link to the sql server tables through MS Access and run queries.
One of the tables in the sql server database stores a date time value as TEXT in this format:
yyyymmddhhmmsshh
so 2:34:55.01 pm of Feb 28 2011 would look like
'2011022814345501'
I'm currently doing my queries like this
to try and get all values for Dec 2010
does anybody see any problem with this ?
It seems to be working, but of course I can't possibly test for all possible date and time values
I'm worried about text not sorting the way I think it will.
Does anybody foresee any problems that may arise with this ?
I was thinking of doing it like this
that gives the same results as the first way, but like I said I can't possibly test for all possible date and time values
We didn't make the database.
It is part of a product we bought.
We have no rights to change any part of design in the database, or create tables or anything else.
I can link to the sql server tables through MS Access and run queries.
One of the tables in the sql server database stores a date time value as TEXT in this format:
yyyymmddhhmmsshh
so 2:34:55.01 pm of Feb 28 2011 would look like
'2011022814345501'
I'm currently doing my queries like this
Code:
...
where
(
datetime_column Between '2010120100000000' And '2010123199999999'
)
does anybody see any problem with this ?
It seems to be working, but of course I can't possibly test for all possible date and time values
I'm worried about text not sorting the way I think it will.
Does anybody foresee any problems that may arise with this ?
I was thinking of doing it like this
Code:
...
where
(
cdbl(datetime_column) Between 2010120100000000 And 2010123199999999
)
that gives the same results as the first way, but like I said I can't possibly test for all possible date and time values