alter table add 列名 但是提示列名无效

来源:百度知道 编辑:UC知道 时间:2024/05/05 04:49:49
请教,我修改现有临时表添加了一列,然后修改这一列的值,却提示刚添加的这一列无效。语句如下:
select * into #ta2 from #ta1
alter table #ta2 add fentry int null
update #ta2 set fentry = 1

alter table 语法错误,少了个参数,可以尝试修改如下:alter table #ta2 add column fentry int null

不会啊,看起来代码没有错,alter table语法没有错的,

我用楼主的代码在sql server 2005测试通过的,不知道楼主

的问题根源是不是出现在其他地方,你可以试试一条一条来

执行,确认无误就继续,这样比较容易发现错误

--试试这样
select * into #ta2 from #ta1
go
alter table #ta2 add fentry int null
go
update #ta2 set fentry = 1
go