一个sql表中原先有个id字段,是统一4位数的,现在想在4位数前统一加个数字1,该怎么办?谢谢
一个sql表中原先有个id字段,是统一4位数的,现在想在4位数前统一加个数字1,该怎么办?谢谢 --------------------编程问答-------------------- update table set id='a'+id如果ID是数字
update table set id=convert(int,'123'+convert(varchar(64),id)) --------------------编程问答-------------------- 如果id是字符类型的话update tablename set id = '1' + id
如果id是数字类型的话
update tablename set id = 10000 + id
或使用链接方式,如下
update tablename set id = cast(('1'+cast(id as varchar(5)) as int) --------------------编程问答-------------------- 非常感谢! --------------------编程问答--------------------
正解
补充:.NET技术 , ASP.NET