SQL: Update a row and returning a column value with 1 query
You want the OUTPUT clause
UPDATE Items SET Clicks = Clicks + 1
OUTPUT INSERTED.Name
WHERE Id = @Id
Accesses table only once :
DECLARE @Name varchar(MAX);
UPDATE Items SET Clicks = Clicks + 1 , @Name = Name WHERE Id = @Id;
SELECT @Name;
If you're using SQL Server 2005 onwards, the OUTPUT clause is ideal for this