Sql语句摘要
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
2.批量更新收藏表
--申明一个游标
DECLARE MyCursor CURSOR
FOR select id from productaudio where productid = 756407 order by linkurl
declare @x int
set @x=1
--打开一个游标
OPEN MyCursor
--循环一个游标
DECLARE @id int
FETCH NEXT FROM MyCursor INTO @id
WHILE @@FETCH_STATUS =0
BEGIN
update productaudio set audioname = @x where id = @id
set @x=@x+1
FETCH NEXT FROM MyCursor INTO @id
END
--关闭游标
CLOSE MyCursor
--释放资源
DEALLOCATE MyCursor
Sql语句摘要的更多相关文章
- 使用Hive或Impala执行SQL语句,对存储在HBase中的数据操作
CSSDesk body { background-color: #2574b0; } /*! zybuluo */ article,aside,details,figcaption,figure,f ...
- 使用Hive或Impala执行SQL语句,对存储在Elasticsearch中的数据操作(二)
CSSDesk body { background-color: #2574b0; } /*! zybuluo */ article,aside,details,figcaption,figure,f ...
- 使用Hive或Impala执行SQL语句,对存储在Elasticsearch中的数据操作
http://www.cnblogs.com/wgp13x/p/4934521.html 内容一样,样式好的版本. 使用Hive或Impala执行SQL语句,对存储在Elasticsearch中的数据 ...
- 使用BAT批处理执行sql语句的代码
使用BAT批处理执行sql语句的代码 有时候需要执行一些Sql语句时,不想开企业管理器,或者是发给客户执行但那边又不懂代码,这时就可以用下面方法 1.把待执行Sql保存在一个文件,这里为2011022 ...
- Python与开源GIS:在OGR中使用SQL语句进行查询
摘要: 属性选择与空间选择都可以看作是OGR内置的选择功能,这两种功能可以解决大部分实际中的问题.但是也有这种时候,就是进行查询时的条件比较复杂.针对这种情况,OGR也提供了更加灵活的解决方案:支持使 ...
- 看懂SqlServer查询计划 SQL语句优化分析
转自 http://www.cnblogs.com/fish-li/archive/2011/06/06/2073626.html 阅读目录 开始 SQL Server 查找记录的方法 SQL Ser ...
- 《万能数据库查询分析器》实现使用SQL语句直接高效地访问文本文件
<万能数据库查询分析器>实现使用SQL语句直接高效地访问文本文件 马根峰 (广东联合电子服务股份有限公司, 广州 510300) 摘要 用SQL语句来直接访问文本文件?是在做梦吗? ...
- 软件开发顶尖高手的杀手锏SQL语句
软件开发顶尖高手的杀手锏SQL语句 ...
- 由一条sql语句想到的子查询优化
摘要:相信大家都使用过子查询,因为使用子查询可以一次性的完成很多逻辑上需要多个步骤才能完成的SQL操作,比较灵活,我也喜欢用,可最近因为一条包含子查询的select count(*)语句导致点开管理系 ...
随机推荐
- c#学习笔记 VS编辑器常用设置
1.NET Framework 4.0安装好后目录在哪里? C:\Windows\Microsoft.NET\Framework下面 C#中CLR和IL分别是什么含义? CLR common lang ...
- spring的<array>标签错误
1,复习了一下spring xml的配置 单个默认命名空间 我们看到,在配置文件中,beans,bean等元素我们是没有使用命名空间前缀的.重复限定一个要在命名空间中使用的元素或属性可能会非常麻烦.这 ...
- (转)Android开发--常用的传感器总结
随着手机的发展,现在各大手机支持的传感器类型也越来越多,在开发中利用传感器进行某些操作令人们有一种耳目一新的感觉,例如微信中的摇一摇,以及手机音乐播放器中的摇一摇切歌.今天来简单介绍下Android中 ...
- Maven项目中突然找不到Build Path或maven dependencies library
这两天发现有个maven项目抽风了,一个是右击项目找不到Build Path了,一个是依赖的lib库没了,maven引入的依赖包导不了.后来发现是eclipse搞的鬼,出问题的是项目下的.classp ...
- unidac 执行Execute后取得受影响行数。
unidac 执行Execute后取得受影响行数. uniQuery2.SQL.Text := mmo2.Text; uniQuery2.Execute; mmo1.Lines.Add(Format( ...
- java代码----equals和==区别
总结: ==的意义在于比较的是整型 package com.aa; // public class Bd { public static void main(String[] args) { Inte ...
- codeforce 985B Switches and Lamps(暴力+思维)
Switches and Lamps time limit per test 3 seconds memory limit per test 256 megabytes input standard ...
- 合并石子(dp)
合并石子 时间限制: 1 Sec 内存限制: 128 MB提交: 7 解决: 7[提交][状态][讨论版][命题人:quanxing] 题目描述 在一个操场上一排地摆放着N堆石子.现要将石子有次序 ...
- easyui tree 加载展开全部节点
$(function () { $('#tbClientListCont').tree({ checkbox: false, url: '/ashx/Client/tbClientList.ashx? ...
- Apache+PHP多端口多站点
# # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the defaul ...