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 |
|
IBoonZ
Yak Posting Veteran
53 Posts |
Posted - 2009-04-14 : 07:21:33
|
| hiwhen i gotABC-00ABC-11ABClitestBMA_EXTRAi only want the 00 and 11So i used following querycase when table like '%ABC%' then right(table,2) else table end.But i get everthing then. 0011en ST (from ABCLITEST).so then i tried case when table like '%ABC%' and isnumeric(right(table,2) then right (table,2)else table end.but i get error of "an expression of non-boolean type specified in a context where a condition is excpected near 'then' |
|
|
IBoonZ
Yak Posting Veteran
53 Posts |
Posted - 2009-04-14 : 07:26:52
|
| found it :).If mods want they can delete is, maybe i can help other ppl with following answercase isnumeric(right(table,2)) when 1 then right(table,2)else table end |
 |
|
|
hambalang
Starting Member
4 Posts |
Posted - 2009-04-14 : 07:28:32
|
| ISNUMERIC returns 1 when the input expression evaluates to a valid integer. So, let's try "case when table like '%ABC%' and isnumeric(right(table,2) = 1 then right (table,2)else table end" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-14 : 07:28:41
|
Won't work.Try with this sample dataABC-0D E 12°55'05.63"N 56°04'39.26" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-04-14 : 07:29:41
|
[code]SELECT RIGHT(Col1, 2)FROM Table1WHERE Col1 LIKE '%[0-9][0-9]'[/code] E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|