这个直接放代码,比较简单
declare @str nvarchar(50)
set @str='9%'
if charindex('%',@str)>0
begin
if ISNUMERIC(replace(@str,'%',''))=1
begin
select cast(replace(@str,'%','') as decimal(11,2))/100
end
end
这个直接放代码,比较简单
declare @str nvarchar(50)
set @str='9%'
if charindex('%',@str)>0
begin
if ISNUMERIC(replace(@str,'%',''))=1
begin
select cast(replace(@str,'%','') as decimal(11,2))/100
end
end
本文标题:Sql Server-实用技巧-字符串类型的百分数怎么转为小数
本文链接:https://www.haomeiwen.com/subject/eaihphtx.html
网友评论