I know I can update a single record like this - but then how to I get access to the id of the record that was updated? (I\'m using MSSQL so I can\'t use Oracles RowId)
Does this have to be in a single statement? Ultimately this would be best as a stored procedure
Create Procedure doMyUpdate
@Id int output
as
Set @Id = (select top 1 itemId from myTable)
update myTable
set myCol = 'foo'
where itemId = @Id
another way would be to use th RETURN keyword and the built in RETURN_VALUE parameter...
Create Procedure doMyUpdate
as
Declare @Id int
Set @Id = (select top 1 itemId from myTable)
update myTable
set myCol = 'foo'
where itemId = @Id
RETURN @Id