Author |
Topic |
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2010-02-23 : 07:29:20
|
hi, here is my queryDECLARE @TestVal int;SET @TestVal = select DATEDIFF(ss,loadendtime,timeackcreated)/3600.0 from sample_currentSELECT CASE WHEN @TestVal > 3 THEN 'Not sent' WHEN @TestVal < =3 THEN 'sent' ELSE 'Other' ENDif i run this query it is not working, it shows error. what could be the problenm here? the output of the select DATEDIFF(ss,loadendtime,timeackcreated)/3600.0 from sample_current will be 4 to 5 rows of data. so how to do this using procedure or query. please help me |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-02-23 : 07:35:23
|
selectcasewhen DATEDIFF(ss,loadendtime,timeackcreated)/3600.0 > 3 then 'not send'when DATEDIFF(ss,loadendtime,timeackcreated)/3600.0 <= 3 then 'sent'else 'other' end as Column_Namefrom sample_current No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-23 : 07:37:46
|
select case when DATEDIFF(ss,loadendtime,timeackcreated)/3600.0 > 3 THEN 'Not sent'when DATEDIFF(ss,loadendtime,timeackcreated)/3600.0 < 3 THEN 'sent'else 'Other'endfrom sample_currentMadhivananFailing to plan is Planning to fail |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-23 : 07:38:20
|
MadhivananFailing to plan is Planning to fail |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-23 : 07:41:30
|
I wondered how we posted in the same alignment of code MadhivananFailing to plan is Planning to fail |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-02-23 : 07:44:32
|
It is not the first time - maybe we are twins No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-23 : 07:47:02
|
quote: Originally posted by webfred It is not the first time - maybe we are twins No, you're never too old to Yak'n'Roll if you're too young to die.
Not the first time?Can you show anyother threads that happened like this?MadhivananFailing to plan is Planning to fail |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-02-23 : 07:51:16
|
http://www.sqlteam.com/FORUMS/topic.asp?TOPIC_ID=128961 No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-23 : 07:54:44
|
quote: Originally posted by webfred http://www.sqlteam.com/FORUMS/topic.asp?TOPIC_ID=128961 No, you're never too old to Yak'n'Roll if you're too young to die.
Fantastic Good that you remember that MadhivananFailing to plan is Planning to fail |
|
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2010-02-23 : 23:12:38
|
Thank you guys. |
|
|
|