UFN_ADHOCQUERY_ISDISPLAYORDERINUSE
Checks if a display order value is used by an ad-hoc query for a specific folder.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@PARENTFOLDERID | uniqueidentifier | IN | |
@DISPLAYORDER | int | IN |
Definition
Copy
CREATE function dbo.UFN_ADHOCQUERY_ISDISPLAYORDERINUSE
(
@PARENTFOLDERID uniqueidentifier,
@DISPLAYORDER int
)
returns bit
with execute as caller
as
begin
declare @RETURNVALUE bit
set @RETURNVALUE = 1
if exists (
select 1 from dbo.ADHOCQUERY
where
(FOLDERID = @PARENTFOLDERID or (FOLDERID is null and @PARENTFOLDERID is null)) and
DISPLAYORDER = @DISPLAYORDER
)
or exists (
select 1 from dbo.SMARTQUERYINSTANCE
where
(FOLDERID = @PARENTFOLDERID or (FOLDERID is null and @PARENTFOLDERID is null)) and
DISPLAYORDER = @DISPLAYORDER
)
set @RETURNVALUE = 0
return @RETURNVALUE
end