如何在SQL Server 2014中将整数列转换为varchar?

时间:2016-11-16 17:26:14

标签: sql-server

enter image description here

我已经复制了SQL Server中的结果,但最后一列(expected_rn_af)除外,后来添加了该列。

如何使用SQL Server中的update语句将列rn_af转换为expected_rn_af

2 个答案:

答案 0 :(得分:4)

在char()

中添加64 + rn_af
Update YourTable
   Set Expected_Rn_af = char(64+rn_af)

答案 1 :(得分:0)

看起来你想要一个案例陈述......

...
case 
   when rn_af = 1 then 'A' 
   when rn_af = 2 then 'B'
   ...
end as expected_rn_af