How to insert a row in MS SQL if the row already not inserted. There are two approach for this task
Solution 1
If Not Exists(select * from REP where NAME=? AND CODE='SALIH')
Begin
insert into REP (NAME,CODE) values ('SALIH','SALIH')
End
Solution 2
insert into REP (code,NAME)
Select 'SAFVAN1','SAFVAN' Where not exists(select * from REP where code='SAFVAN1' AND NAME='SAFVAN')