Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
tyh2003
Starting Member
3 Posts |
Posted - 2009-03-02 : 23:57:20
|
| I am currently working on a parking system project, one of the system functions is that when the car arrives terminal, it needs to evaluate whether the arrival time is within the zone opening hours?? for example, parker arrival time is 13:52zone opening houts is from 9:00 to 23:00 how could it know whether the arrival time is within the zone opening hours? I have tried several method in sql server express. I found that i could not just enter time (e.g 12:20) for datetime field type, it only accepts yyyy/mm/hh hh:mm:ss format, is it the default format of sql server express? i really have no idea of how to get it done, anyone could help or give some hints for me?? thks |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-03-03 : 00:09:36
|
| please see this link:--http://www.sql-server-helper.com/tips/date-formats.aspx |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-03-03 : 00:17:45
|
| declare @parkerarrivaltime datetimeselect @parkerarrivaltime ='6:52'select @parkerarrivaltimeif(@parkerarrivaltime between '9:00' and '23:00')select 'With in time'elseselect 'Time Exceeded'select case when @parkerarrivaltime between '9:00' and '23:00' then 'With in time' else 'Time Exceeded' end as description |
 |
|
|
|
|
|