时间:2021-07-01 10:21:17 帮助过:40人阅读
USE AdventureWorks2008R2;
UPDATE TOP (10) Sales.Store
SET SalesPersonID = 276
WHERE SalesPersonID = 275;
GO
如果需要使用 TOP 来应用按有意义的时间顺序排列的更新,您必须同时使用 TOP 和 ORDER BY 子句。下列示例更新了雇佣最早的 10 名雇员的假期小时数。
Transact-SQLUPDATE HumanResources.Employee SET VacationHours = VacationHours + 8 FROM (SELECT TOP 10 BusinessEntityID FROM HumanResources.Employee ORDER BY HireDate ASC) AS th WHERE HumanResources.Employee.BusinessEntityID = th.BusinessEntityID; GOG M T
选项 : 历史 : 反馈 : Donate | 关闭 |
SQL Server Update:使用 TOP 限制更新的数据
标签:alert round ble etc provider 操作 store red zh-cn