SELECT column_name
FROM table_name
WHERE TRY_CONVERT(int, column_name) IS NULL
SELECT column_name
FROM table_name
WHERE ISNUMERIC(column_name) = 0
Declare @x varchar(10) = '12,456'
SELECT CAST(@x as int)
Also spaces or empty strings '' may throw an error, although for some reason I can't replicate this on my SSMS 2012 box.
Declare @x varchar(10) = '12.456'
SELECT CASE
WHEN ISNUMERIC(@x) = 1 THEN CAST(CAST(@x as numeric(19,4)) as int)
ELSE NULL end
SELECT a.column_name
FROM (
SELECT CASE
WHEN ISNUMERIC(column_name) = 1 THEN CAST(CAST(column_name as numeric(19,4)) as int)
ELSE NULL end as column_name
FROM your_table) a
WHERE a.column_name < 50
select cast(replace('9,10,223,345.99',',','') as decimal(18,3))
You'll need to remove the punctuation from the string.
SELECT replace (column_name, ',', '') from mytable;
Then just recast the result.
SELECT cast (replace (column_name, ',', '') as double) from mytable;
Good Luck!
Kent