dbTalk Databases Forums  

calculating time range values

microsoft.public.sqlserver.datawarehouse microsoft.public.sqlserver.datawarehouse


Discuss calculating time range values in the microsoft.public.sqlserver.datawarehouse forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
raul
 
Posts: n/a

Default calculating time range values - 06-18-2012 , 09:31 AM






can someone help me with this? I am trying to create a computed column by calculating time range but it gives me errors with all the numbers assignedin the 'between' assignment. It seems like the code structure is wrong BUT i cant figured it out. If I do a select with the convert assignment typecome out in that format.


thanks for any help,

Raul Rego

jjkgr (AT) hotmail (DOT) com


USE [njpies]
GO
ALTER TABLE [dbo].[aidsdata] ADD GROUP_TIME_SHIFT AS
CASE
WHEN convert(time(0), DATE_CALL, 108) between 07:00:00 and 14:59:59 then '1st Shift'
WHEN convert(time(0), DATE_CALL, 108) between 15:00:00 and 22:59:59 then'2nd Shift'
when convert(time(0), DATE_CALL, 108) between 23:00:00 and 06:59:59 then'3rd Shift'

end
PERSISTED

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.