我创建了这个脚本,允许在表中插入一些转储数据。当我执行这个 SPROC 并插入 @N 时,SPROC 会无限运行。
知道我做错了什么。
CREATE PROCEDURE CreateSampleData
@N INT
AS
DECLARE @row INT
SET @row = 1
DECLARE @randomGuid VARCHAR(36)
DECLARE @randomText VARCHAR
WHILE @row <= @N
BEGIN
-- Set Random Values
SET @randomText = (SELECT LEFT(Cast(Newid() AS VARCHAR(36)), 20))
SET @randomGuid = Newid()
INSERT INTO [XXX].[dbo].[YYY]
([Id],
[eventid],
[eventtitle],
[day number],
[day],
[datetimestart],
[datetimeend],
[location],
[staff],
[uniquestudentreference],
[reminder])
VALUES ( @randomGuid,
@randomText,
@randomText,
'2',
'Monday',
'08:50:00',
'10:50:00',
@randomText,
@randomText,
'Silvia',
'n' )
END
GO