Code CREATEFUNCTION[dbo].[udf_SystemUser]
(
) RETURNS@SystemUserTABLE([Account]nvarchar(30),[Password]nvarchar(30)) AS BEGIN INSERT@SystemUser ([Account],[Password]) VALUES('Insus.NET','insus@2009.NET'); RETURN END
然后可以在存储过程,引用这个表值函数:
Code CREATEPROCEDURE[dbo].[usp_CheckSystemUser]
( @Accountnvarchar(30), @Passwordnvarchar(30)
) AS IFNOTEXISTS(SELECT*FROM[dbo].[udf_SystemUser]() WHERE[Account]=@AccountAND[Password]=@Password) BEGIN RAISERROR(N'数据验证未被通过,无法登录!',16,1) RETURN END