读书人

引用其他表(带identity列)的数据用

发布时间: 2012-02-25 10:01:48 作者: rapoo

引用其他表(带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 ...

读书人网 >Sybase

热点推荐