27,579
社区成员
发帖
与我相关
我的任务
分享
select *,cast(itemName as int) num, cast(val as decimal(10,9)) scale
from CommonData.dbo.base_v_infoClass
where parentName='比例'
select *,cast(itemName as int) num, cast(val as decimal(10,9)) scale
from CommonData.dbo.base_v_infoClass
where parentName='比例'
select cast(itemName as int) num, cast(val as decimal(10,9)) scale
from CommonData.dbo.base_v_infoClass
where parentName='比例'
declare @T table([itemName] varchar(4))
insert @T
select 'xx商' union all
select '4' union all
select '5' union all
select '6'
--select *,cast([itemName] as int) from @T
/*
Conversion failed when converting the varchar value 'xx商' to data type int.
*/
select *,cast([itemName] as int) from @T
where isnumeric(itemName )=1
/*
itemName
-------- -----------
4 4
5 5
6 6
*/