日期:2014-05-18 浏览次数:20700 次
create proc checkmac
@mac varchar(50),@msg varchar(50) output
as
begin
  if exists(select 1 from 表A where MAC1=@mac)
  begin
    select @msg='表A.MAC1已存在此mac.'
    return
  end
  if not exists(select 1 from 表A where MAC2=@mac)
  begin
    select @msg='表A.MAC2不存在此mac.'
    return
  end
    insert into 表A(MAC1) values(@mac)
    select @msg='mac新增成功.'
end