您的位置:首页 > 其它

新增字段不为空默认值,然后关更新数据

2011-06-10 15:18 267 查看
--修改数据库,新增列并默认值为1

Alter Table shougeinfo Add CANTON_ID int not null default 1

---批量更新数据,就是把默认值改为CANTON_ID

update shougeinfo

set shougeinfo.canton_id=B.[ID] from CANTON B

where substring(polt_id,1,charindex('#',polt_id)-1)=B.[NAME]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐