|
Posted by --CELKO-- on 05/03/06 19:50
In SQL Server, there is not DATE data type or TIME data type -- but
there is a single DATETIME. Quit doing all that converting and work
with temporal expressions instead of COBOL-style strings. Think in
abstract terms, not how it is displayed on a piece of paper or a
screen.
WHERE trade_time BETWEEN start_time AND end_time
will work fine, if you bother to add constraints to start_time (i.e
00:00:00) and end_time (23:59:59.9999) columns. Another trick is to
allow end_time to be NULL when an event is still in progress and then
use COALESCE (end_time, CURRENT_TIMESTAMP)
If you look up Rick Snodgrass at University of Arizona, you can
download his out-of-print book on temporal SQL queries.
Navigation:
[Reply to this message]
|