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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 CASE WHEN Type xxx THEN StartDateActual issue

Author  Topic 

bhdijkstra
Starting Member

24 Posts

Posted - 2011-04-29 : 05:20:16
CASE WHEN Type xxx THEN StartDateActual WHEN Type ('xx, xx, xx') THEN StartDate END is not working.

Execute error:

Conversion failed when converting the varchar value 'xx, xx' to data type int.

When this is complete I can choose this new name as a parameter in my report. Anyone any idea to create a working CASE?

raghuveer125
Constraint Violating Yak Guru

285 Posts

Posted - 2011-04-29 : 05:21:53
Post some dummy data

Raghu' S
Go to Top of Page

bhdijkstra
Starting Member

24 Posts

Posted - 2011-04-29 : 05:24:02
CASE WHEN TYPE = 3113 THEN StartDateActual WHEN TYPE IN ('10; 13') THEN StartDate END
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-04-29 : 05:26:23
IN(10,13)


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

raghuveer125
Constraint Violating Yak Guru

285 Posts

Posted - 2011-04-29 : 05:28:07
Try this

CASE WHEN thpe=3113 THEN StartDateActual
else
CASE WHEN TYPE IN ('10; 13')
THEN
StartDate
END
END

Raghu' S
Go to Top of Page

bhdijkstra
Starting Member

24 Posts

Posted - 2011-04-29 : 05:35:12
quote:
Originally posted by raghuveer125

Try this

CASE WHEN thpe=3113 THEN StartDateActual
else
CASE WHEN TYPE IN ('10; 13')
THEN
StartDate
END
END

Raghu' S



same error
Go to Top of Page

bhdijkstra
Starting Member

24 Posts

Posted - 2011-04-29 : 05:36:08
quote:
Originally posted by webfred

IN(10,13)


No, you're never too old to Yak'n'Roll if you're too young to die.



same error
Go to Top of Page

raghuveer125
Constraint Violating Yak Guru

285 Posts

Posted - 2011-04-29 : 05:37:04
REPLACE TYPE IN ('10;13) TO TYPE IN (10,13)--THIS IS YOUR INT DATA TYPE NO.

Raghu' S
Go to Top of Page

bhdijkstra
Starting Member

24 Posts

Posted - 2011-04-29 : 05:53:19
yes, thanks this is working.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-04-29 : 05:57:00
That's nothing other than I've posted...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

raghuveer125
Constraint Violating Yak Guru

285 Posts

Posted - 2011-04-29 : 05:59:41
Yes i did not see. Thank You Webfred

Raghu' S
Go to Top of Page
   

- Advertisement -