UFN_BANKACCOUNTROUTINGUNIQUE
this function validates the uniqueness of account plus routing number combination.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ACCOUNT | nvarchar(50) | IN | |
@ROUTING | nvarchar(9) | IN |
Definition
Copy
CREATE function dbo.UFN_BANKACCOUNTROUTINGUNIQUE
(
@ACCOUNT nvarchar(50),
@ROUTING nvarchar(9)
)
returns bit
with execute as caller
as begin
declare @COUNT integer;
declare @RESULT bit;
select @COUNT = COUNT(BANKACCOUNT.ID)
from dbo.BANKACCOUNT
where ACCOUNTNUMBER=@ACCOUNT and ROUTINGNUMBER=@ROUTING
if @COUNT <= 1
return 1;
return 0;
end