Code CREATEFUNCTION[dbo].[ExclusionAccount]
( @Accountnvarchar(30)
) RETURNSbit AS BEGIN DECLARE@Resultbit IF@AccountIN ('administrator','admin','system','sys','sysadmin','db') SET@Result=1 ELSE SET@Result=0 RETURN@Result END
在用户注册或是更改帐号时,如同下面判断:
Code DECLARE@IsEXISTbit SELECT@IsEXIST= (SELECT[dbo].ExclusionAccount(@Account)) IF(@IsEXIST=1) BEGIN RAISERROR(N'此帐号:%s是系统预定帐号!',16,1,@Account) RETURN END