我是 SQL 的新手,但这是我目前所拥有的:
Alter Procedure GetallSchedule(@ScreenKey INT,@ShowNo INT) As
BEGIN
--DECLARE @ScreenKey INT
--DECLARE @ShowNo INT
--Declare @j INT
--Declare @i INT
Insert into Schedule(Cineplex,
ScreenKey,ShowOrder,ShowNo,FilmKey,ShowDate,ShowTime)
Values (1,@ScreenKey,1,@ShowNo,100,GETDATE(),GETDATE())
SET @ShowNo = 1
SET @ScreenKey = 1
WHILE (@ScreenKey <=20)
BEGIN
WHILE (@ShowNo <=7)
BEGIN
Insert into Schedule(
Cineplex,
ScreenKey,ShowOrder,ShowNo,FilmKey,ShowDate,ShowTime)
Values (1,@ScreenKey,1,@ShowNo,100,GETDATE(),GETDATE())
SET @ShowNo = @ShowNo + 1
END
SET @ScreenKey = @ScreenKey + 1
END
END
go
--Execute GetallSchedule 'TUC'
在这里,我需要插入同时增加Screenkey
和的值ShowNo
。我需要获得 20 个屏幕的结果,每个屏幕有 7 个节目