日期:2014-05-18 浏览次数:20550 次
go create proc check_username @usercode char(16) as declare @retcode int , @retdesc char(80) select @retcode=-999,@retdesc='用户名已存在' if exists(select 1 from tbl where 部门=@usercode) begin select @retcode=1,@retdesc='用户名已存在' end else begin select @retcode=0,@retdesc='用户名可以使用' end select @retcode as retcode,@retdesc as retdesc exec check_username '1' /* retcode retdesc 1 用户名已存在 */ 我的机器上测试没有报错