How do I store the select column in a variable?
I tried this, but it throws me an error "Incorrect syntax":
declare @EmpId int SELECT dbo.Employ
This is how to assign a value to a variable:
SELECT @EmpID = Id FROM dbo.Employee
However, the above query is returning more than one value. You'll need to add a WHERE clause in order to return a single Id value.
WHERE
Id