提示列名无效解决方法
提示列名无效
alter table #B add zdx int identity ---加一自动增长列
select max(zdx) from #B ---取自动增长列的最大值
以上语句显示错误:列名无效‘ZDX’,怎么解决?
------解决方案--------------------
--这句要放在动态SQL中
exec ('alter table #B add zdx int identity ')
------解决方案--------------------
alter table #B add zdx int identity ---加一自动增长列
select max(zdx) from #B ---取自动增长列的最大值
两次使用临时表,应该成功不了.
alter table B add zdx int identity ---加一自动增长列
select max(zdx) from B ---取自动增长列的最大值
------解决方案--------------------
select * into #t from jobs
alter table #t
add id1 int identity
select max(id1) from #t
14
我试了都可以啊
alter table #B add zdx int identity ---加一自动增长列
select max(zdx) from #B ---取自动增长列的最大值
以上语句显示错误:列名无效‘ZDX’,怎么解决?
------解决方案--------------------
--这句要放在动态SQL中
exec ('alter table #B add zdx int identity ')
------解决方案--------------------
alter table #B add zdx int identity ---加一自动增长列
select max(zdx) from #B ---取自动增长列的最大值
两次使用临时表,应该成功不了.
alter table B add zdx int identity ---加一自动增长列
select max(zdx) from B ---取自动增长列的最大值
------解决方案--------------------
select * into #t from jobs
alter table #t
add id1 int identity
select max(id1) from #t
14
我试了都可以啊