Possible Duplicate:
Finding duplicate values in a SQL table
I'm completely new to T-Sql and Sql programming in general so I'm hoping someone can steer me in the right direction. Here's my problem.. I have a table with only 2 columns, AppliedBandwidthSourceKey and AppliedBandwithSource for simplicity I'll call them columns A and B respectively.
Columns A and B compose the primary key. When I try to insert a record where the value for column A already exists I immediately get a Primary Key constraint violation and if column A doesn't exist but column B does I get Unique Key constraint violation. My question is how do I check if the 'value pair' already exists in the table? if does then do nothing otherwise insert.
I've seen several solutions to similar problems using tsql's merge and if not exists statements but I just can't grasp the concept. Any help would be greatly appreciated.