批量插入数据库
时间:2021-07-01 10:21:17
帮助过:5人阅读
,@project varchar(
50),@title varchar(
50) ,@userName varchar(
50),@userRowGuid varchar(
50)
select @i=
0 ,@project=
‘dt20180328-3e44-4870-a2c3-2e7aa0932dce‘,
@title=
‘mmmmmm‘,@userName=
‘‘,@userRowGuid=
‘1d2629ce-e521-4196-a25b-c86d3edfdd41‘ ---->
给变量赋值,i为循环条件,此处为0
while @i<
10 ---->
i每次循环后加1,直到i大于10
begin ---->
开始执行sql
INSERT INTO [BIMPM_Document].[dbo].[ArchivesFileCategory] (
[RowGuid],[ProjectRowGuid],[ParentRowGuid],[Title],[Description],[SortOrder],[CreateUserRowGuid],[CreationDate],[LastModificationDate],[Type])
values(Newid(),@project,‘‘,@title,
‘‘,
1,@userRowGuid,GETDATE(),GETDATE(),
1) -
SELECT @i=@i+
1 ---->
sql执行完,变量递增
END
批量插入数据库
标签:select pre 赋值 int arch creat user bsp ica