UFN_SPONSORSHIPLOCATION_UNIQUE_LOCATIONUNDERNODE
Verifies that the specified location is unique within its parent node.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@NAME | nvarchar(100) | IN | |
@HIERARCHYPATH | hierarchyid | IN |
Definition
Copy
create function dbo.UFN_SPONSORSHIPLOCATION_UNIQUE_LOCATIONUNDERNODE(
@NAME nvarchar(100),
@HIERARCHYPATH hierarchyid
)
returns bit
with execute as caller
as begin
declare @COUNT smallint
select @COUNT = count(*)
from dbo.SPONSORSHIPLOCATION
where NAME = @NAME
and HIERARCHYPATH.GetAncestor(1) = @HIERARCHYPATH.GetAncestor(1)
if @COUNT > 1
return 0
return 1
end