I need select only strings in my table, but this table has numbers and strings together.
Ex:
ID Name
1 Jacke11
2 Andre
3 Rodrigo11
4 55555
My select need return only Ids: 1, 2, 3.
Thanks
I need select only strings in my table, but this table has numbers and strings together.
Ex:
ID Name
1 Jacke11
2 Andre
3 Rodrigo11
4 55555
My select need return only Ids: 1, 2, 3.
Thanks
SELECT ID
FROM YourTable
WHERE ISNUMERIC(Name + '.0e0') = 0
+ '.0e0' as I don't think it's very intuitive to need that.ISNUMERIC since it will evaluate TRUE for non-int datatypes like float (also money and some symbols). 12e10 will pass ISNUMERIC as TRUE. By adding the .0e0 you force it to check only for integer values.As an alternative to Joe's very fine ISNUMERIC solution, you can use PATINDEX to make sure you have an alpha character:
SELECT ID
FROM YourTable
WHERE PATINDEX('%[a-z]%', name) > 0
This may be slightly faster since it will stop searching the string as soon as it gets to the first alpha character.