UFN_BANKACCOUNTSORTCODEUNIQUE
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 | |
| @SORTCODE | nvarchar(6) | IN |
Definition
Copy
CREATE function dbo.UFN_BANKACCOUNTSORTCODEUNIQUE
(
@ACCOUNT nvarchar(50),
@SORTCODE nvarchar(6)
)
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 SORTCODE=@SORTCODE
if @COUNT <= 1
return 1;
return 0;
end