I am trying to add multiple value to a variable in my stored procedure. My requirement is to store multiple values in a variable and use it again later to delete the values.
DECLARE @EmpID
SET @EmpID = (SELECT e.id
FROM employee e,Technology t
WHERE e.status = 'InActive'
AND e.id = t.Mainid
UNION
SELECT e.id
FROM employee e,Technology t
WHERE e.status = 'InActive'
AND e.id = t.AssociateID)
DELETE FROM Technology
WHERE Mainid IN (@EmpID) OR AssociateID IN (@EmpID)
When I tried this query, I'm getting an error
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.