当前位置: 代码迷 >> Sybase >> 引用其他表(带identity列)的数据,用带另一identity的select into语句建立临时表时,报错,请问
  详细解决方案

引用其他表(带identity列)的数据,用带另一identity的select into语句建立临时表时,报错,请问

热度:737   发布时间:2013-02-26 00:00:00.0
引用其他表(带identity列)的数据,用带另一identity的select into语句建立临时表时,报错,请教
比如:
表A,   有一个column:id是identity列

现在我要在某存储过程中建立一张临时表,用语句:
select   id2=identity(12),   A.*   into   @temp_tbl   ...

现在,sybase报错:
Attempting   to   add   a   new   identity   field   to   a   table   '@temp_tbl ',   via   select   into,   which   would   have   a   field   'id '   that   inherits   the   identity   property.  

由于我是要写一个公用的分页用的存储过程,所以在存储过程内部是不知道A的情况的

请问有什么办法解决吗?

------解决方案--------------------------------------------------------
表A已经有一个identity column了,一个表只能有一个identity column
你可以
select id2=identity(12), A.col1,A.col2..... into @temp_tbl ...
  相关解决方案