select case when sign(field1) = 1 then '是' else '否' end from Table1
select case when 字段名=1 then '是' else '否' end from 表名字
CASE 字段 when '1' THEN '是' ELSE '否' END
select case 字段名 when 0 then '否' else '是' end from tbl
select case when 字段名=1 then '是' else '否' end from 表名字
if object_id('pubs..test') is not null drop table test go create table test ( id varchar(10), value int ) insert into test(id,value) values('1' , 1) insert into test(id,value) values('2' , 0)select * from test select id , case when value=1 then '是' else '否' end as value from testdrop table test--结果 id value ---------- ----------- 1 1 2 0(所影响的行数为 2 行)id value ---------- ----- 1 是 2 否(所影响的行数为 2 行)
drop table test
go
create table test
(
id varchar(10),
value int
)
insert into test(id,value) values('1' , 1)
insert into test(id,value) values('2' , 0)select * from test
select id , case when value=1 then '是' else '否' end as value from testdrop table test--结果
id value
---------- -----------
1 1
2 0(所影响的行数为 2 行)id value
---------- -----
1 是
2 否(所影响的行数为 2 行)