UFN_TAXID_VALIDSTATEENTITY
This checks to see if the state tax type is the only active state type for that state.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ENTITYTYPECODE | smallint | IN | |
@STATEID | uniqueidentifier | IN |
Definition
Copy
create function dbo.UFN_TAXID_VALIDSTATEENTITY
(
@ENTITYTYPECODE smallint,
@STATEID uniqueidentifier
)
returns bit
with execute as caller
as begin
declare @COUNT integer;
declare @RESULT bit;
If @ENTITYTYPECODE = 1
select @COUNT = COUNT(TAXID.ID)
from dbo.TAXID
where ENTITYTYPECODE=@ENTITYTYPECODE and STATEID=@STATEID and STATUSCODE=1
else
return 1
if @COUNT <= 1
return 1;
return 0;
end