SQL语句创建表并插入指定N条数据(用于测试)

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<50000
BEGIN
INSERT INTO TestTable(D_Name,D_Password,D_Else)
VALUES(""名称"",""暗码测试"",""其他"")
SET @index=@index+1
END
SELECT [语句履行花费时候(毫秒)]=datediff(ms,@d,getdate()) --计时停止

posted on 2012-10-25 17:41  _o~ 努力!  阅读(367)  评论(0编辑  收藏  举报

导航