日期:2014-05-18  浏览次数:20456 次

加一列升序列号码
下面的Alter为什么不行,有其他办法在现有表#Result里加一列升序列号码
select   top   100   orderid,cast(null   as   int)   RowId   into   #result   from   oeborder
ALTER   TABLE   #Result   ALTER   COLUMN   RowId   int   IDENTITY   (1,1)   null
select   *   from   #result
Drop   Table   #result

------解决方案--------------------
--try

select top 100 ID=identity(int, 1, 1), orderid,cast(null as int) RowId into #result from oeborder
------解决方案--------------------
select top 100 RowId=identity(int, 1, 1), orderid into #result from oeborder

select * from #result

------解决方案--------------------
ALTER TABLE #Result ADD RowId int IDENTITY (1,1)

这样既可
------解决方案--------------------
把以前的那列删除