FirstName LastName University
Bob Brown Aviation
Kate Dylan Economic
Tommy Loren Aviation
大学有默认值:Aviation。有将值插入表的存储过程,在过程调用中有 3 个参数:
@declare firstname varchar(50),
@declate lastname varchar(50),
@declare university varchar(50)
insert into myTbl (FirstName,LastName,University) values(@firstname,@lastname,@university)
我想如果在过程中@university 是空的,不要插入到表中,例如如果我执行:
EXEC myProcedure 'Joseph','Divan',''
它必须只插入到表中,名字和姓氏大学将是 Aviation,因为它是默认值