UFN_SCHEMA_INDEX_GETISSYSTEMFLAG
Return
| Return Type | 
|---|
| bit | 
Parameters
| Parameter | Parameter Type | Mode | Description | 
|---|---|---|---|
| @TABLENAME | nvarchar(128) | IN | |
| @INDEXNAME | nvarchar(128) | IN | 
Definition
 Copy 
                                    
CREATE function dbo.UFN_SCHEMA_INDEX_GETISSYSTEMFLAG
(
    @TABLENAME nvarchar(128),
    @INDEXNAME nvarchar(128)
)
returns bit
with execute as caller
as begin
    declare @value bit;
    select @value = cast(ep.value as bit) from 
    sys.extended_properties as ep 
    inner join sys.indexes as ix on ep.major_id=ix.[object_id] and ep.minor_id=ix.index_id
    where ep.class=7 and ep.major_id=OBJECT_ID(@TABLENAME) and ep.minor_id > 0 and ep.[name]=N'BB_IsSystem' and ix.[name]=@INDEXNAME;
    return ISNULL(@value,0);
end