sql语句怎么判断字段值=0时,字断的值就等Q

来源:百度知道 编辑:UC知道 时间:2024/06/25 01:30:25

如果是SELECT如下
SELECT case 字段 when '0' then 'q' else 字段 end 字段 from 表
更新就更简单了.
UPDATE 表 SET 字段='Q' WHERE 字段='0'

ORACLE 用decode(字段,'0','q',字段)

isnull(Store_Storage.StoreName,"Q")

select *,case ziduan when 0 then 'q' as ziduan from table

试试看!

declare @test varchar(20)

set @test='0'

if @test=cast(0 as varchar(20))
begin
set @test='Q'
print @test
end

else
begin
print @test
end