I have a trigger which inserts data to a table from another table based on a condition like below :
DECLARE @pID VARCHAR(50);
SELECT @pID = I.pID FROM inserted I;
INSERT INTO Queue ( ID )
SELECT ID
FROM Inventory
WHERE pID = @pID
How can I check if the ID exist before inserting?
Note : There will be multiple records returned from -
SELECT ID
FROM Inventory
WHERE pID = @pID