1、使用ISNUMERIC函数判断数据是否是数字。返回值为1表示是数字,为0表示不是。
select column_name from table_name where isnumeric(column_name) = 1;
2、使用TRY_CONVERT函数尝试将varchar类型的数据转换为数字。如果转换成功,该函数会返回转换后的结果,否则返回null。
select column_name from table_name where TRY_CONVERT(float, column) is not null;
3、使用正则表达式判断数据是否可转换为数字。
select column_name from table_name where column_name like '%[0-9]%' and column_name not like '%[^0-9]%';