使用ISNUMERIC
declare @a varchar(20)set @a = 'notanumber'select case when isnumeric(@a) = 0 then 0 else convert(numeric(18,0),@a) end

使用ISNUMERIC
declare @a varchar(20)set @a = 'notanumber'select case when isnumeric(@a) = 0 then 0 else convert(numeric(18,0),@a) end