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 |
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2010-09-06 : 06:54:33
|
Hi Guys, Hoping someone can spot something I can't, I'm trying to return some data from a table holding information on Books. But in the startpage somepeople have not entered data or text instead of a value, because I'm trying to use this column for a calculation I thought I'd use a case when to convert it to INT where its numeric else leave as it is.SELECT CASE WHEN ISNUMERIC(StartPage) = 0 THEN StartPage ELSE CONVERT(INT,StartPage ) END, ISNUMERIC(StartPage) FROM books (Nolock) WHERE ID = 852695However when I run this query it displays an error saying it can't change "i" into INT datatype, that's fine but the ISNUMERIC(StartPage) = 0 clause returns 0 so it shouldn't attempt to convert that value.Where am I going wrong.-----------------------------------------------Learning something new on SQL Server everyday. |
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2010-09-06 : 07:12:39
|
Excellent Thanks-----------------------------------------------Learning something new on SQL Server everyday. |
 |
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2010-09-06 : 07:14:46
|
quote: Originally posted by NeilG Excellent Thanks-----------------------------------------------Learning something new on SQL Server everyday.
Welcome Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
|
|