没有identity主健时

Code
DECLARE @iden int
DECLARE @iKey int
SELECT 0 AS aa ,COMMENT_ID,COMMENT_DES INTO #tt FROM BBS_COMMENT
SET @iden = 0
DECLARE cur CURSOR FOR SELECT COMMENT_ID FROM #tt
OPEN cur
FETCH cur INTO @iKey
WHILE @@FETCH_STATUS = 0
BEGIN
SET @iden = @iden +1
UPDATE #tt SET aa = @iden WHERE COMMENT_ID = @iKey
FETCH cur INTO @iKey
END
CLOSE cur
DEALLOCATE cur
SELECT * FROM #tt
DROP table #tt
有identity主健时
SELECT identity(int,1,1) as aa,[USER_ID] INTO #tt FROM BBS_COMMENT
SELECT * FROM #tt
DROP table #tt