我需要关于 While 语句的帮助,我以前从未使用过,并且想知道必须重复序列,直到我达到目标:
例如
1
2
3
4
1
2
3
4
Until 5000
我试图写自己的,但被卡住了:
USE Occupancy
CREATE TABLE Bookings2
(Booking_Skey INT IDENTITY (1,1) not null,
PitchType_Skey INT not null)
DECLARE @PitchType_Skey INT
SET @PitchType_Skey = 1
WHILE (@PitchType_Skey <= 4)
BEGIN
INSERT INTO Bookings2(PitchType_Skey)
SELECT @PitchType_Skey
SET @PitchType_Skey = @PitchType_Skey + 1
END