3
I would like to assign the value of the local variable within the SELECT
, as in the example below, but displays the following error message:
"A SELECT statement that assigns a value to a variable must not be Combined with data-Retrieval Operations."
CREATE PROCEDURE [dbo].[TESTE]
@Param INT
AS
BEGIN
SET NOCOUNT ON;
DECLARE @VariavelLocal DECIMAL,@VariavelLocal2 DECIMAL
SELECT (@VariavelLocal1 = SELECT COUNT(TesteId) FROM Table)
,(@VariavelLocal2 = 1)
,@VariavelLocal1 + @VariavelLocal2
,T2.T2Teste
FROM Table2 T2
END
You can do this?