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 |
|
ddobbertin
Yak Posting Veteran
51 Posts |
Posted - 2008-08-27 : 08:12:46
|
| Very tired....my brain is just not in it today. This is easy and quick if someone could help.I have a timestamp field on a customer's database in the format of '08/27/2008 05:55:24.454'.I need to be able to query that timestamp field to assign workers shifts.Example:Update punchedin set shift = '1' where timestamp between '05:00:00.000' and '13:00:00.000' |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-08-27 : 08:19:04
|
[code]Update punchedin set shift = '1' where datepart(hour, timestamp) between 5 and 13[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-27 : 08:29:50
|
| Is '13:00:00.000' inclusive?MadhivananFailing to plan is Planning to fail |
 |
|
|
ddobbertin
Yak Posting Veteran
51 Posts |
Posted - 2008-08-27 : 08:56:50
|
| '13:00:00.000' is inclusive. Those were also just examples. The times would be more like '03:45:00.000' and '16:25:00.000'. I was thinking the same thing with doing datepart for the hour and minutes but thought maybe there was a cleaner more efficient way to get it done. |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
|
|
|
|