I have a simple table with columns - id, name, and salary.
I want to get the name, salary and annual salary by id using a stored procedure.
I thought of creating a simple stored procedure like this:
CREATE PROCEDURE spGetDetails
@id int,
@annualSal int out
AS
BEGIN
SELECT
name, salary,
@annualSal = (salary * 12)
FROM
tblPrac
WHERE
id = @id
END
But I'm getting an error:
A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations
If this qs is already asked please give me the link and I'll delete this qs. I searched but I think I'm missing the key word. Thanks
@annualSal int outparamter