I have a table named
dbo.Inventory in SQL Server 2016 like this:
ProdCode UPCCode 1 11111 2 11112 3 11113
When adding a new row, I need to write a trigger that will check for a duplicate in that column. If it is a duplicate I need it to give an error and not change the column. Otherwise, I need it to insert like normal.
I can't use a unique index because I have a lot of rows with a value of NULL.