插入临时表分页排序时“添加标识列,该表中已有继承了标识属性的列 'id'”问题的解决方法
排序分页,SQL2000,遇到如下问题
select identity(int ,1,1) as pid, id ,username,classid into #collectionInfos from pk_collection
select * from #collectionInfos
---
id 是原表标识列,自增。
数据库报错如下:
服务器: 消息 8108,级别 16,状态 1,行 1
无法使用 SELECT INTO 语句向表 '#collectionInfos' 中添加标识列,该表中已有继承了标识属性的列 'id'。
网上查到的方案都是去掉标识列,去掉了标识列还有多大用处啊,汗。
想了想,转化一下,如下:
----
select identity(int ,1,1) as pid, cast(id as int) as id ,username,classid into #collectionInfos from pk_collectionInfo
select * from #collectionInfos
问题解决。

浙公网安备 33010602011771号