store procedure
create procedure AddMatch
@resultname nvarchar(10)
with encryption
as if exists(select resultid from MatchResult where resultname = @resultname )
begin
print 'Don't store'
end
else
begin
insert into MatchResult(resultname) value (@resultname)
print 'store'
end
execute AddMatch 'redwin'
store procedure allows to pass parameters. Before inserting new data, it can check weather the data has already existed in table or not.