码迷,mamicode.com
首页 > 数据库 > 详细

Sql语句摘要

时间:2015-01-12 18:57:41      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:

1.分批更新数据库

declare @x int
set @x=1
while(@x<=51)
begin
begin tran
update UserFavorite set UserFavorite.firstpublishtime = product.lastpublishtime
from UserFavorite,product where UserFavorite.productid = product.id
and UserFavorite.id between (@x-1)* 10000 and @x*10000
commit tran
set @x=@x+1
WAITFOR DELAY ‘00:00:30‘; --等待5秒
end

Sql语句摘要

标签:

原文地址:http://www.cnblogs.com/smileberry/p/4218855.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!