Bunu yapmak istiyorum:
DECLARE @Id INT;
UPDATE Logins
SET SomeField = 'some value'
OUTPUT @Id = Id
WHERE EmailAddress = @EmailAddress -- this is a parameter of the sproc
Bu mümkün mü? Yerel bir tablo değişkeni bildirebilir ve çıktıyı oraya yönlendirebilirim, ancak mümkünse atlamayı tercih ederim
SELECT. Hatayı alıyorum"A nested INSERT, UPDATE, DELETE, or MERGE statement is not allowed in a SELECT statement that is not the immediate source of rows for an INSERT statement."Bu biraz talihsiz çünkü sadece tek bir satırı etkilediğinizi bildiğinizde gerçekten temiz bir çözüm.