I use the following t-sql code for assign to variable a value obtained from select statement
DECLARE @cfMitt nvarchar(16)
SET @cfMitt = (SELECT CfMittente
FROM Messaggi
WHERE IDMessaggio = @IDMessaggio)
If I want use multiple assignement I try with the following code, but something is wrong:
DECLARE @cfMitt nvarchar(16)
DECLARE @cfDest nvarchar(16)
SET @cfMitt, @cfDest= (SELECT CfMittente, CfDestinatario
FROM Messaggi
WHERE IDMessaggio = @IDMessaggio)
Where is the error?