/***************创建测试表*********************
****************downmoo 3w@live.cn ***************/
IF NOT OBJECT_ID('[Demo_Top]') IS NULL
DROP TABLE [Demo_Top]
GO
Create table [Demo_Top]
(PID int ident
ITy(1,1)
Primary key not null
,PN
ame nv
Archar(100) null
,AddTime dateTime null
,PGuid N
VARchar(40)
)
go
truncate table [Demo_Top]
/***************创建1002条测试数据*********************
****************downmoo 3w@live.cn ***************/
declare @d datetime
set @d=getdate()
declare @i int
set @i=1
while @i<=1002
be
gin insert into [Demo_Top]
select cast(datepart(ms,getdate()) as nvarchar(3))+Replicate('A',datepart(ss,getdate()))
,getdate()
,NewID()
set @i=@i+1
end
Declare @
PErcentage float
set @percentage=1
select Top (@percentage) percent PName
From [Demo_Top] order by PName
--注意是11行。(11 row(s) affected)
select PName,AddTime, PGuid f
rom [Demo_Top]
TableSample
System(10 percent)
--(77 row(s) affected)
的表的并发性,可以用于大的报表或数据仓库应用程序。此外,分块操作可以避免日志的快速增长,因为前一操作完成后,可能会重用日志空间。如果操作中有事务,已经完成的修改数据已经可以用于查询,而不必等待所有的修改完成。