select
case 0
when 1 then Convert(numeric(10,2),12.1234)
when 0 then '你好'
end消息 8114,级别 16,状态 5,第 2 行
將資料類型從 varchar 轉換到 numeric 時發生錯誤。
case 0
when 1 then Convert(numeric(10,2),12.1234)
when 0 then '你好'
end消息 8114,级别 16,状态 5,第 2 行
將資料類型從 varchar 轉換到 numeric 時發生錯誤。
select
case 0
when 1 then convert(varchar(10),Convert(numeric(10,2),12.1234))
when 0 then '你好'
end
当1,是numeric,当0 是varchar
是无法通过的
case 0
when 1 then cast(convert(varchar(10),Convert(numeric(10,2),12.1234)) as varchar)
when 0 then '你好'
end
对啊,我也知道,类型不对,但case 0,case 1是按条件选取一个执行 逻辑上也过关啊 一定要把这二个参数的类型弄的一样吗?
case 0
when 1 then convert(varchar(10) , cast(12.1234 as decimal(10,2)))
when 0 then '你好'
end
你好(所影响的行数为 1 行)