DECLARE @MAXID INT
SET @MAXID=5
DECLARE @TBL TABLE
(
ID INT ,
NAME VARCHAR(56)
)
INSERT INTO @TBL VALUES (NULL,'A')
INSERT INTO @TBL VALUES (NULL,'A')
INSERT INTO @TBL VALUES (NULL,'A')
UPDATE @TBL SET @MAXID = ID = @MAXID+1
SELECT * FROM @TBL
SET @MAXID=5
DECLARE @TBL TABLE
(
ID INT ,
NAME VARCHAR(56)
)
INSERT INTO @TBL VALUES (NULL,'A')
INSERT INTO @TBL VALUES (NULL,'A')
INSERT INTO @TBL VALUES (NULL,'A')
UPDATE @TBL SET @MAXID = ID = @MAXID+1
SELECT * FROM @TBL
No comments:
Post a Comment