经常使用的语句!
--大批量导出orders表:insert
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE
go
SET NOCOUNT ON
BEGIN TRANSACTION
INSERT INTO test.dbo.orders with(tablock) SELECT * FROM
bak.dbo.Orders
WHERE ordertime BETWEEN '2010-05-01' AND '2010-05-10'
COMMIT
go
--大批量导出orders表:delete
DBCC DROPCLEANBUFFERS DBCC FREEPROCCACHE go SET NOCOUNT ON BEGIN TRANSACTION while 1=1 begin delete top(1000) from test.dbo.orders with(tablock) WHERE ordertime BETWEEN '2010-05-01' AND '2010-05-10' if @@rowcount<1000 break end COMMIT go
总结以上是内存溢出为你收集整理的实战:sqlserver 大数据量的insert、delete *** 作优化全部内容,希望文章能够帮你解决实战:sqlserver 大数据量的insert、delete *** 作优化所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)