查询语句问题,不会写?具体请进来看看! select id,Case id when '1' then 'A' else id end from A表 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select id,Case c when '1' then 'A' else c end from A表 select id,case when c='1' then 'a' else c endfrom a 楼上的写法都没有问题,不过前提,列C的定义不能为INT,只能为CHAR或者VARCHAR,否则就会出现转换错误. 应该没有问题,int可以直接转换为字符型,倒回去有的转换不过去。select id,c=Case id when '1' then 'A' else c end from A表 为了预防万一:select id,C=Case id when 1 then 'A' else convert(varchar,c) end from A表 我要查询是select A表 if 字段C 的 值为 1 则 显示 Aelse 显示原值-----------------------Select Id,C=case when C=1 then 'A' else cast(C as varchar(4)) end from A sql server2005的问题 储存过程中删除多个表的数据.删除不了. 关于管理器的打开问题 关于多字段 select 语句出错求助! 如何设置表中一列的默认值? 求一sql查询写法 日志传送出错“无法初始化”怎么回事? 对数据库长时间的操作,有可能连接中断吗? 删除SQl server数据库中某张表的某个字段为重复值的记录的SQL语句如何写? 那位老大幫忙參考一下這條語句 power designer 是数据库case工具,请问这个东西有没有中文版本的?我找不到啊。
select id,Case c when '1' then 'A' else c end from A表
from a
select id,C=Case id when 1 then 'A' else convert(varchar,c) end from A表
select A表
if 字段C 的 值为 1 则 显示 A
else 显示原值-----------------------
Select Id,C=case when C=1 then 'A' else cast(C as varchar(4)) end from A