I have a table named dbo.Inventory in SQL Server 2016 as follows:
ProdCode UPCCode 1 11111 2 11112 3 11113
When I add a new line, I have to write a trigger that looks for a duplicate in that column. If it is a duplicate, there must be an error and not change the field. If not, it must be inserted as usual. I'm really sure how I would do it, any help would be very grateful!