双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

通过脚本添加字段不成功

jashionqq jashionqq 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
/*create table test(
lxh int,
msg varchar(80)
)
*/

if not exists (select name from syscolumns where id = object_id('test') and name = 'ss')
begin
alter table test add ss int default(0);
update test set ss = lxh;
end;
执行脚本后报错,报错信息如下:
消息 207,级别 16,状态 1,第 0 行
列名 'ss' 无效。
另:if not exists (select name from syscolumns where id = object_id('test') and name = 'ss')
begin
alter table test add ss int default(0);
--update test set ss = test.lxh;
end;
执行这句脚本是成功的
...全文
评论 4
收藏 已收藏
分享
返回顶部
jashionqq
疑难问题 22,298 成员 121,727 内容