declare @minId int set @minId =0;
declare @maxId int set @maxId =154;
print(@minId)
print(@maxId)
while(@minId<@maxId)
begin
insert into table1
( [Title]
,[FileDoc]
,[PostUserId]
,[PostUserName]
,[PostTime]
,[Remark]
,[DocType]
,[Visible]
,[Type]
,[Type2]
,[UpdateTime]
,[UpdateUserId]
)
select [Title]
,[FileDoc]
,[PostUserId]
,[PostUserName]
,[PostTime]
,[Remark]
,[DocType]
,[Visible]
,[Type]
,[Type2]
,[UpdateTime]
,[UpdateUserId] from table
where [FileId]>@minId and [FileId]<=@minId + 1 //加号后面得数据是你一次要插入得条数,可自定义用于数据量大得库批量插入
set @minId = @minId + 1
print(@minId)
end ---循环插入