用无参存储过程循环插入测试数据
1 USE [数据库名称] 2 SET ANSI_NULLS ON 3 GO 4 SET QUOTED_IDENTIFIER ON 5 GO 6 alter PROCEDURE dbo.pro_photosImport 7 AS 8 declare @i int 9 set @i = 1 10 declare @uid int 11 set @uid= 1 12 declare @username varchar(64) 13 set @username ='' 14 declare @cat int 15 set @cat = 1 16 while (@i < 600000) 17 begin 18 Set @i =@i +1 19 select @uid = userid,@username=username from dbo.spb_Users select @cat = categoryid
from dbo.spb_PhotoUserCategories 20 INSERT INTO [dbo].[spb_Photos]([OwnerUserID],[UserCategoryID],[SiteCategoryID],[Author],[PostDate],
[LastRepliedDate],[PrivacyStatus],[IsLocked],[Password],[AuditingStatus],[IsEssential],[SpecialOrder],
[StickyDate],[HitTimes],[CommentCount],[RssViewTimes],[RatingSum],[TotalRatings],[Subject],[Body],
[UserHostAddress],[FileName],[ContentType],[ContentSize],[Height],[Width],[PropertyNames],[PropertyValues]) 22 VALUES(@uid,@cat,0,@username,getdate(),getdate(),30,0,'',40,0,0,'1754-01-01 00:00:00.000',
1,0,0,0,0,'可爱的图片','我很细可爱的图片哦!','192.168.1.65','2788267502545.jpg','image/jpeg',
32897,493,330,null,null) 23 end 24 go