Additional SQL Server features and topics not covered by specific categories
Hi @BeUnique
Not sure why you check data exists from table Employee, while insert into another table EmailsRecebidos.
To avoid duplicate, shouldn't the logic be both the same table?
IF NOT EXISTS
(SELECT * FROM YourTable WHERE column1 = @value1 AND column2 = @value2)
BEGIN
INSERT INTO YourTable (column1, column2) VALUES (@value1, @value2);
END
Best regards,
Cosmog
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".