UFN_R68_UNIQUECLAIMNUMBERS
Returns true if all entries in the R68 table with the same reference number either have unique tax claim numbers or don't have tax claim numbers.
Return
Return Type |
---|
bit |
Definition
Copy
create function dbo.UFN_R68_UNIQUECLAIMNUMBERS()
returns bit
with execute as caller
as begin
declare @COUNT int;
select @COUNT = max(PAIRCOUNT) from
(select COUNT(*) PAIRCOUNT from dbo.R68 where len(TAXCLAIMNUMBER)>0 group by REFERENCENUMBER, TAXCLAIMNUMBER) PAIRS
if @COUNT > 1
return 0;
return 1;
end