insert into testMy (id, myname)
SELeCT 1, 'Me'
WHEre NOT Exists(select * from TestMy WHERe MyName = 'Me')
or, we can use insert and update in single statement without the use of stored procedure.
if exists(select * from testMy where id = 3)
update testMy set myname = 'They' where id = 3
else
insert into testMy (id, myname) values(3, 'They')
SELeCT 1, 'Me'
WHEre NOT Exists(select * from TestMy WHERe MyName = 'Me')
or, we can use insert and update in single statement without the use of stored procedure.
if exists(select * from testMy where id = 3)
update testMy set myname = 'They' where id = 3
else
insert into testMy (id, myname) values(3, 'They')