
数据库字段是int类型,但是我在前台对应的要显示中文,我怎么在SQL语句里,直接判断并赋值呢?
4个回答
展开全部
如果是 在SQL查询中直接修改 首先把字段的属性由 INT 改为 VCARHAR
UPDATE 表名称
SET 字段名 ='全部' WHERE 字段名='1'
UPDATE 表名称
SET 字段名 ='全部' WHERE 字段名='1'
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
create table t1
(
tid bit
)
go
insert into t1 values(0)
insert into t1 values(1)
select * from t1
select (case tid when 0 then N'这个是0' else N'这个是1' end) as result from t1
以上这个希望能满足你的需求!
(
tid bit
)
go
insert into t1 values(0)
insert into t1 values(1)
select * from t1
select (case tid when 0 then N'这个是0' else N'这个是1' end) as result from t1
以上这个希望能满足你的需求!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
mwtcz 正解
select case int_col when 0 then '男' else '女' end case from yourtable
select case int_col when 0 then '男' else '女' end case from yourtable
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select case int_col when 0 then '' else '' end case from yourtable where ...
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询