CREATE TABLE [dbo].[TestTable](
[D_Id] [int] IDENTITY NOT NULL,
[D_Name] [varchar](50) NULL,
[D_Password] [varchar](32) NULL,
[D_Else] [varchar](4000) NULL,
CONSTRAINT [PK_TestTable] PRIMARY KEY CLUSTERED
([D_Id] ASC)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
DECLARE @d datetime
SET @d=getdate() --計時開始
DECLARE @index INT
SET @index = 1
WHILE @index<5000
BEGIN
INSERT INTO TestTable(D_Name,D_Password,D_Else)
VALUES('名稱'+Cast(@index as varchar),'密碼測試'+Cast(@index as varchar),'其他'+Cast(@index as varchar))
SET @index=@index+1
END
SELECT [語句執行花費時間(毫秒)]=datediff(ms,@d,getdate()) --計時結束