October 14, 2008 at 2:23 pm
Hi Every body
Could you please help me
Which channels watched most of the time any help me how can write a qurey for this
stat_id event_no channel event_tim
001 Pwr_on Etv 07:10:21 CDT06/13/1997
002 Dtv_ch Gemini 07:10:29 CDT06/13/1997
003 dtv_guide Etv 07:10:38 CDT06/13/1997
October 14, 2008 at 2:41 pm
What is the data type of the event_tim column? Do I need to find the time difference between row 1 and row 2 in order to get the time a channel was watched? So etv would be watched for 8 seconds and then Gemini for 9 seconds then back to etv, but there is on way of knowing when the last row ended in the data you supplied. What would I do with the last row?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
October 14, 2008 at 2:49 pm
hi friend
thank u for ur reply
that data type is 'evet_date'
now could u please give good suggestion how can i calulate the sum of them
October 14, 2008 at 2:59 pm
There is no such thing as an evet_date date type in SQL Server. It could be a user defined type and then you need to let me know what type it is based on.
I am assuming the data in that column means that event 1 took place on June 13, 1997 at 7:10:21 am. Is that a correct assumption?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
October 14, 2008 at 3:20 pm
hi hall
'19:12:43 CDT 05/23/2007' this is event_date but it is in varchar datatype.
How can we convert varchar datatype to date time datatype any body plz give suggestion
October 14, 2008 at 3:24 pm
What does the CDT stand for? Are there other values besides CDT in the middle of the time and date?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
October 14, 2008 at 3:38 pm
kumar99ms (10/14/2008)
hi hall'19:12:43 CDT 05/23/2007' this is event_date but it is in varchar datatype.
How can we convert varchar datatype to date time datatype any body plz give suggestion
You should look at converting these into UTC time, or something based off of a standard time zone. I'm assuming that CDT is Central Daylight time.
If you were to convert this to UTC time - you'd want to combine the date and time, then cast that as a datetime:
declare @ts varchar(40)
set @ts='19:12:43 CDT 05/23/2007'
select cast(right(@ts,10)+' '+left(@ts, 8) as datetime)
and then adjust by 5 hours (to get to UTC). Final code would look like:
declare @ts varchar(40)
set @ts='19:12:43 CDT 05/23/2007'
select dateadd(hour,5,cast(right(@ts,10)+' '+left(@ts, 8) as datetime))
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply