USE AdventureWorks2008R2; GO DECLARE complex_cursor CURSOR FOR SELECT a.BusinessEntityID FROM HumanResources.EmployeePayHistory AS a WHERE RateChangeDate <> (SELECT MAX(RateChangeDate) FROM HumanResources.EmployeePayHistory AS b WHERE a.BusinessEntityID = b.BusinessEntityID) ; OPEN complex_cursor; FETCH FROM complex_cursor; UPDATE HumanResources.EmployeePayHistory SET PayFrequency = 2 WHERE CURRENT OF complex_cursor; CLOSE complex_cursor; DEALLOCATE complex_cursor; GO |
相关文章
- SQL Server 2005、2008 的 datetime 值范围(转)
- SQL 必知必会·笔记<14>更新和删除数据
- 在SQL Server中实现日期
- 查看SQL server 2008 R2 的Service Package 版本号(同样适用于SQL Server 2005)
- SQL Server查看视图定义总结
- SQL Server 事务以及事务日志综述
- Windows Phone 8 SQL Server CE 数据库
- EXCEL某列长度超过255个字符导入SQL SERVER的处理方法
- sql server 2008有关SQL的模糊查询
- SQL SERVER 2005 获取表的所有索引信息以及删除和新建语句