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.

posted on 2011-12-06 18:12  qih33  阅读(166)  评论(0)    收藏  举报

导航