Get Updated Row
问题 I have a query that updates one record, and only one record. Is there are way to get the Id updated in the same query such as Select ScopeIdentity when inserting. UPDATE Task SET MyTime = GetDate(), MyUserId = @userid FROM (select top 1 table where SomeStuff) Select Lastrow that just got updated. 回答1: Depending on what you are doing, you may need to use the table syntax of OUTPUT . A possibility is to specify a temporary table / table variable. DECLARE @T TABLE ( MyID INT NOT NULL ) UPDATE