DECLARE @A1 INT
DECLARE @A2 INT
SELECT @A1 = MIN( ISNULL(AA00100, 0) ), @A2 = MAX(AA00100) FROM AA001 WHERE STATUS = 1
CREATE TABLE #T
(
ID int IDENTITY(1,1),
WORKCODE int not null,
)
---------------------------
WHILE @A1 < @A2
BEGIN
INSERT INTO #T (WORKCODE) VALUES (@A1)
SET @A1= @A1+1
END
---------------------------
SELECT * FROM #T
DROP TABLE #T
------解决方案--------------------
select identity(int,1,1) as id
into #t
from sysobjects
------解决方案--------------------
DECLARE @a INT
DECLARE @b INT
SELECT @a=ISNULL(MIN(AA00100),0),
@b=MAX(AA00100)
FROM AA001 WHERE STATUS = 1
SELECT IDENTITY(INT,1,1) AS id,
@a AS WORKCODE
INTO dbo.#
FROM syscolumns
WHERE id <[email protected]
AND id> [email protected]
SELECT * FROM #