4

Is there a function or system view that returns all of the available property names?

I was looking for 'SYSTEMDATAACCESS' and 'USERDATAACCESS' which aren't listed on the MSDN OBJECTPROPERTY page. I added a comment about them, but am wondering if there are others that I don't know about...given that it's SQL I'd expect them to be available as queryable metadata somewhere, but couldn't find anything. Are the properties in the meta data somewhere?

EDIT: While it isn't really relevant to my question, here is an example usage of system data access. select OBJECTPROPERTY(OBJECT_ID('sys.dm_db_stats_properties'), 'SYSTEMDATAACCESS')

8
  • I only get NULL returned when querying for those properties. Can you add a repro to your question?
    – Hannah Vernon
    Nov 20, 2015 at 17:52
  • 1
    You should look into OBJECTPROPERTYEX which has SystemDataAccess and UserDataAccess.
    – Kin Shah
    Nov 20, 2015 at 17:55
  • I'm seeing NULL for both OBJECTPROPERTY and OBJECTPROPERTYEX for both those items. Other properties listed on the OBJECTPROPERTY page do work for me, so I'm confident I'm not doing something wrong.
    – Hannah Vernon
    Nov 20, 2015 at 17:59
  • 1
    @MaxVernon these are properties for functions.
    – jmoreno
    Nov 20, 2015 at 18:45
  • @Kin: Thanks for the reference to OBJECTPROPERTYEX
    – jmoreno
    Nov 20, 2015 at 18:49

2 Answers 2

2

Is there a function or system view that returns all of the available property names?

No. There isn't even something that returns the names of all of the available built in functions (such as OBJECTPROPERTY itself).

These property values are documented for OBJECTPROPERTYEX even though they do also appear to work for OBJECTPROPERTY and probably should be documented there (the return type is int so there is no reason that they shouldn't be supported there and it is more convenient to work with that function without needing a cast from sql_variant.)

For entirely undocumented property values (such as minlen for INDEXPROPERTY) I'm not aware of any way of determining these.

2

Here is a script that will allow you to query all documented property names and property values using the OBJECTPROPERTYEX function https://msdn.microsoft.com/en-us/library/ms188390.aspx

OBJECTPROPERTYEX contains all the same properties as OBJECTPROPERTY, but returns a SQL_Variant type instead of int, and so has more options such as BaseType which will return a char(2).

Here is the SQL Script with a few examples of how to use:

  CREATE TABLE #tmpObjectPropertyEX_List (PropertyName nvarchar(50), PropertyAppliesTo nvarchar(256), PropertyDesc nvarchar(3000));
  INSERT INTO #tmpObjectPropertyEX_List (PropertyName, PropertyAppliesTo, PropertyDesc) 
   SELECT [PropertyName] = N'BaseType', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'Identifies the base type of the object. When the specified object is a SYNONYM, the base type of the underlying object is returned. Nonnull = Object type Base data type: char(2)'     UNION ALL SELECT [PropertyName] = N'CnstIsClustKey', [PropertyAppliesToType] = N'Constraint', [PropertyDesc] = N'PRIMARY KEY constraint with a clustered index. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'CnstIsColumn', [PropertyAppliesToType] = N'Constraint', [PropertyDesc] = N'CHECK, DEFAULT, or FOREIGN KEY constraint on a single column. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'CnstIsDeleteCascade', [PropertyAppliesToType] = N'Constraint', [PropertyDesc] = N'FOREIGN KEY constraint with the ON DELETE CASCADE option. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'CnstIsDisabled', [PropertyAppliesToType] = N'Constraint', [PropertyDesc] = N'Disabled constraint. 1 = True 0 = False Base data type: int'   UNION ALL SELECT [PropertyName] = N'CnstIsNonclustKey', [PropertyAppliesToType] = N'Constraint', [PropertyDesc] = N'PRIMARY KEY constraint with a nonclustered index. 1 = True 0 = False Base data type: int'   UNION ALL SELECT [PropertyName] = N'CnstIsNotRepl', [PropertyAppliesToType] = N'Constraint', [PropertyDesc] = N'Constraint is defined by using the NOT FOR REPLICATION keywords. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'CnstIsNotTrusted', [PropertyAppliesToType] = N'Constraint', [PropertyDesc] = N'Constraint was enabled without checking existing rows. Therefore, the constraint may not hold for all rows. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'CnstIsUpdateCascade', [PropertyAppliesToType] = N'Constraint', [PropertyDesc] = N'FOREIGN KEY constraint with the ON UPDATE CASCADE option. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'ExecIsAfterTrigger', [PropertyAppliesToType] = N'Trigger', [PropertyDesc] = N'AFTER trigger. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'ExecIsAnsiNullsOn', [PropertyAppliesToType] = N'Transact-SQL function, Transact-SQL procedure, Transact-SQL trigger, view', [PropertyDesc] = N'The setting of ANSI_NULLS at creation time. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'ExecIsDeleteTrigger', [PropertyAppliesToType] = N'Trigger', [PropertyDesc] = N'DELETE trigger. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'ExecIsFirstDeleteTrigger', [PropertyAppliesToType] = N'Trigger', [PropertyDesc] = N'The first trigger fired when a DELETE is executed against the table. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'ExecIsFirstInsertTrigger', [PropertyAppliesToType] = N'Trigger', [PropertyDesc] = N'The first trigger fired when an INSERT is executed against the table. 1 = True 0 = False Base data type: int'   UNION ALL SELECT [PropertyName] = N'ExecIsFirstUpdateTrigger', [PropertyAppliesToType] = N'Trigger', [PropertyDesc] = N'The first trigger fired when an UPDATE is executed against the table. 1 = True 0 = False Base data type: int'   UNION ALL SELECT [PropertyName] = N'ExecIsInsertTrigger', [PropertyAppliesToType] = N'Trigger', [PropertyDesc] = N'INSERT trigger. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'ExecIsInsteadOfTrigger', [PropertyAppliesToType] = N'Trigger', [PropertyDesc] = N'INSTEAD OF trigger. 1 = True 0 = False Base data type: int'   UNION ALL SELECT [PropertyName] = N'ExecIsLastDeleteTrigger', [PropertyAppliesToType] = N'Trigger', [PropertyDesc] = N'Last trigger fired when a DELETE is executed against the table. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'ExecIsLastInsertTrigger', [PropertyAppliesToType] = N'Trigger', [PropertyDesc] = N'Last trigger fired when an INSERT is executed against the table. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'ExecIsLastUpdateTrigger', [PropertyAppliesToType] = N'Trigger', [PropertyDesc] = N'Last trigger fired when an UPDATE is executed against the table. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'ExecIsQuotedIdentOn', [PropertyAppliesToType] = N'Transact-SQL function, Transact-SQL procedure, Transact-SQL trigger, view', [PropertyDesc] = N'Setting of QUOTED_IDENTIFIER at creation time. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'ExecIsStartup', [PropertyAppliesToType] = N'Procedure', [PropertyDesc] = N'Startup procedure. 1 = True 0 = False Base data type: int'   UNION ALL SELECT [PropertyName] = N'ExecIsTriggerDisabled', [PropertyAppliesToType] = N'Trigger', [PropertyDesc] = N'Disabled trigger. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'ExecIsTriggerNotForRepl', [PropertyAppliesToType] = N'Trigger', [PropertyDesc] = N'Trigger defined as NOT FOR REPLICATION. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'ExecIsUpdateTrigger', [PropertyAppliesToType] = N'Trigger', [PropertyDesc] = N'UPDATE trigger. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'ExecIsWithNativeCompilation', [PropertyAppliesToType] = N'Transact-SQL Procedure', [PropertyDesc] = N'Procedure is natively compiled. 1 = True 0 = False Base data type: int Applies to: SQL Server 2014 through SQL Server 2016.'      UNION ALL SELECT [PropertyName] = N'HasAfterTrigger', [PropertyAppliesToType] = N'Table, view', [PropertyDesc] = N'Table or view has an AFTER trigger. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'HasDeleteTrigger', [PropertyAppliesToType] = N'Table, view', [PropertyDesc] = N'Table or view has a DELETE trigger. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'HasInsertTrigger', [PropertyAppliesToType] = N'Table, view', [PropertyDesc] = N'Table or view has an INSERT trigger. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'HasInsteadOfTrigger', [PropertyAppliesToType] = N'Table, view', [PropertyDesc] = N'Table or view has an INSTEAD OF trigger. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'HasUpdateTrigger', [PropertyAppliesToType] = N'Table, view', [PropertyDesc] = N'Table or view has an UPDATE trigger. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'IsAnsiNullsOn', [PropertyAppliesToType] = N'Transact-SQL function, Transact-SQL procedure, table, Transact-SQL trigger, view', [PropertyDesc] = N'Specifies that the ANSI NULLS option setting for the table is ON, meaning all comparisons against a null value evaluate to UNKNOWN. This setting applies to all expressions in the table definition, including computed columns and constraints, for as long as the table exists. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'IsCheckCnst', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'CHECK constraint. 1 = True 0 = False Base data type: int'   UNION ALL SELECT [PropertyName] = N'IsConstraint', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'Constraint. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'IsDefault', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'Bound default. 1 = True 0 = False Base data type: int Applies to: SQL Server 2008 through SQL Server 2016.'   UNION ALL SELECT [PropertyName] = N'IsDefaultCnst', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'DEFAULT constraint. 1 = True 0 = False Base data type: int'   UNION ALL SELECT [PropertyName] = N'IsDeterministic', [PropertyAppliesToType] = N'Scalar and table-valued functions, view', [PropertyDesc] = N'The determinism property of the function or view. 1 = Deterministic 0 = Not Deterministic Base data type: int'   UNION ALL SELECT [PropertyName] = N'IsEncrypted', [PropertyAppliesToType] = N'Transact-SQL function, Transact-SQL procedure, table, Transact-SQL trigger, view', [PropertyDesc] = N'Indicates that the original text of the module statement was converted to an obfuscated format. The output of the obfuscation is not directly visible in any of the catalog views in SQL Server 2005. Users without access to system tables or database files cannot retrieve the obfuscated text. However, the text is available to users that can either access system tables over the DAC port or directly access database files. Also, users that can attach a debugger to the server process can retrieve the original procedure from memory at run time. 1 = Encrypted 0 = Not encrypted Base data type: int'     UNION ALL SELECT [PropertyName] = N'IsExecuted', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'Specifies the object can be executed (view, procedure, function, or trigger). 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'IsExtendedProc', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'Extended procedure. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'IsForeignKey', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'FOREIGN KEY constraint. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'IsIndexed', [PropertyAppliesToType] = N'Table, view', [PropertyDesc] = N'A table or view with an index. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'IsIndexable', [PropertyAppliesToType] = N'Table, view', [PropertyDesc] = N'A table or view on which an index may be created. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'IsInlineFunction', [PropertyAppliesToType] = N'Function', [PropertyDesc] = N'Inline function. 1 = Inline function 0 = Not inline function Base data type: int'      UNION ALL SELECT [PropertyName] = N'IsMSShipped', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'An object created during installation of SQL Server. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'IsPrecise', [PropertyAppliesToType] = N'Computed column, function, user-defined type, view', [PropertyDesc] = N'Indicates whether the object contains an imprecise computation, such as floating point operations. 1 = Precise 0 = Imprecise Base data type: int'   UNION ALL SELECT [PropertyName] = N'IsPrimaryKey', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'PRIMARY KEY constraint. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'IsProcedure', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'Procedure. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'IsQuotedIdentOn', [PropertyAppliesToType] = N'CHECK constraint, DEFAULT definition, Transact-SQL function, Transact-SQL procedure, table, Transact-SQL trigger, view', [PropertyDesc] = N'Specifies that the quoted identifier setting for the object is ON, meaning double quotation marks delimit identifiers in all expressions involved in the object definition. 1 = True 0 = False Base data type: int'   UNION ALL SELECT [PropertyName] = N'IsQueue', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'Service Broker Queue 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'IsReplProc', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'Replication procedure. 1 = True 0 = False Base data type: int'   UNION ALL SELECT [PropertyName] = N'IsRule', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'Bound rule. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'IsScalarFunction', [PropertyAppliesToType] = N'Function', [PropertyDesc] = N'Scalar-valued function. 1 = Scalar-valued function 0 = Not scalar-valued function Base data type: int'     UNION ALL SELECT [PropertyName] = N'IsSchemaBound', [PropertyAppliesToType] = N'Function, Procedure, view', [PropertyDesc] = N'A schema bound function or view created by using SCHEMABINDING. 1 = Schema-bound 0 = Not schema-bound Base data type: int'   UNION ALL SELECT [PropertyName] = N'IsSystemTable', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'System table. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'IsSystemVerified', [PropertyAppliesToType] = N'Computed column, function, user-defined type, view', [PropertyDesc] = N'The precision and determinism properties of the object can be verified by SQL Server. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'IsTable', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'IsTableFunction', [PropertyAppliesToType] = N'Function', [PropertyDesc] = N'Table-valued function. 1 = Table-valued function 0 = Not table-valued function Base data type: int'     UNION ALL SELECT [PropertyName] = N'IsTrigger', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'Trigger. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'IsUniqueCnst', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'UNIQUE constraint. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'IsUserTable', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'User-defined table. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'IsView', [PropertyAppliesToType] = N'View', [PropertyDesc] = N'View. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'OwnerId', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'Owner of the object. System_CAPS_noteNote The schema owner is not necessarily the object owner. For example, child objects (those where parent_object_id is nonnull) will always return the same owner ID as the parent. Nonnull = Database user ID of the object owner. NULL = Unsupported object type, or object ID is not valid. Base data type: int'    UNION ALL SELECT [PropertyName] = N'SchemaId', [PropertyAppliesToType] = N'Any schema-scoped object', [PropertyDesc] = N'The ID of the schema associated with the object. Nonnull = Schema ID of the object. Base data type: int'   UNION ALL SELECT [PropertyName] = N'SystemDataAccess', [PropertyAppliesToType] = N'Function, view', [PropertyDesc] = N'Object accesses system data, system catalogs or virtual system tables, in the local instance of SQL Server. 0 = None 1 = Read Base data type: int'   UNION ALL SELECT [PropertyName] = N'TableDeleteTrigger', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has a DELETE trigger. >1 = ID of first trigger with the specified type. Base data type: int'      UNION ALL SELECT [PropertyName] = N'TableDeleteTriggerCount', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'The table has the specified number of DELETE triggers. Nonnull = Number of DELETE triggers Base data type: int'    UNION ALL SELECT [PropertyName] = N'TableFullTextMergeStatus', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Whether a table that has a full-text index that is currently in merging. 0 = Table does not have a full-text index, or the full-text index is not in merging. 1 = The full-text index is in merging. Applies to: SQL Server 2008 through SQL Server 2016.'    UNION ALL SELECT [PropertyName] = N'TableFullTextBackgroundUpdateIndexOn', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'The table has full-text background update index (autochange tracking) enabled. 1 = TRUE 0 = FALSE Base data type: int Applies to: SQL Server 2008 through SQL Server 2016.'   UNION ALL SELECT [PropertyName] = N'TableFulltextCatalogId', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'ID of the full-text catalog in which the full-text index data for the table resides. Nonzero = Full-text catalog ID, associated with the unique index that identifies the rows in a full-text indexed table. 0 = Table does not have a full-text index. Base data type: int Applies to: SQL Server 2008 through SQL Server 2016.'   UNION ALL SELECT [PropertyName] = N'TableFullTextChangeTrackingOn', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has full-text change-tracking enabled. 1 = TRUE 0 = FALSE Base data type: int Applies to: SQL Server 2008 through SQL Server 2016.'    UNION ALL SELECT [PropertyName] = N'TableFulltextDocsProcessed', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Number of rows processed since the start of full-text indexing. In a table that is being indexed for full-text search, all the columns of one row are considered as part of one document to be indexed. 0 = No active crawl or full-text indexing is completed. > 0 = One of the following:  The number of documents processed by insert or update operations since the start of full, incremental, or manual change tracking population. The number of rows processed by insert or update operations since change tracking with background update index population was enabled, the full-text index schema changed, the full-text catalog rebuilt, or the instance of SQL Server restarted, and so on.  NULL = Table does not have a full-text index. Base data type: int Note   This property does not monitor or count deleted rows. Applies to: SQL Server 2008 through SQL Server 2016.'   UNION ALL SELECT [PropertyName] = N'TableFulltextFailCount', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'The number of rows that full-text search did not index. 0 = The population has completed. >0 = One of the following:  The number of documents that were not indexed since the start of Full, Incremental, and Manual Update change tracking population. For change tracking with background update index, the number of rows that were not indexed since the start of the population, or the restart of the population. This could be caused by a schema change, rebuild of the catalog, server restart, and so on  NULL = Table does not have a Full-Text index. Base data type: int Applies to: SQL Server 2008 through SQL Server 2016.'     UNION ALL SELECT [PropertyName] = N'TableFulltextItemCount', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Nonnull = Number of rows that were full-text indexed successfully. NULL = Table does not have a full-text index. Base data type: int Applies to: SQL Server 2008 through SQL Server 2016.'      UNION ALL SELECT [PropertyName] = N'TableFulltextKeyColumn', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'ID of the column associated with the single-column unique index that is part of the definition of a full-text index and semantic index. 0 = Table does not have a full-text index. Base data type: int Applies to: SQL Server 2008 through SQL Server 2016.'    UNION ALL SELECT [PropertyName] = N'TableFulltextPendingChanges', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Number of pending change tracking entries to process. 0 = change tracking is not enabled. NULL = Table does not have a full-text index. Base data type: int Applies to: SQL Server 2008 through SQL Server 2016.'      UNION ALL SELECT [PropertyName] = N'TableFulltextPopulateStatus', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'0 = Idle. 1 = Full population is in progress. 2 = Incremental population is in progress. 3 = Propagation of tracked changes is in progress. 4 = Background update index is in progress, such as autochange tracking. 5 = Full-text indexing is throttled or paused. 6 = An error has occurred. Examine the crawl log for details. For more information, see the Troubleshooting Errors in a Full-Text Population (Crawl) section of Populate Full-Text Indexes. Base data type: int Applies to: SQL Server 2008 through SQL Server 2016.'      UNION ALL SELECT [PropertyName] = N'TableFullTextSemanticExtraction', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table is enabled for semantic indexing. 1 = True 0 = False Base data type: int Applies to: SQL Server 2012 through SQL Server 2016.'   UNION ALL SELECT [PropertyName] = N'TableHasActiveFulltextIndex', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has an active full-text index. 1 = True 0 = False Base data type: int Applies to: SQL Server 2008 through SQL Server 2016.'      UNION ALL SELECT [PropertyName] = N'TableHasCheckCnst', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has a CHECK constraint. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'TableHasClustIndex', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has a clustered index. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'TableHasDefaultCnst', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has a DEFAULT constraint. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'TableHasDeleteTrigger', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has a DELETE trigger. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'TableHasForeignKey', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has a FOREIGN KEY constraint. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'TableHasForeignRef', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table is referenced by a FOREIGN KEY constraint. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'TableHasIdentity', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has an identity column. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'TableHasIndex', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has an index of any type. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'TableHasInsertTrigger', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Object has an INSERT trigger. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'TableHasNonclustIndex', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'The table has a nonclustered index. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'TableHasPrimaryKey', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has a primary key. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'TableHasRowGuidCol', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has a ROWGUIDCOL for a uniqueidentifier column. 1 = True 0 = False Base data type: int'   UNION ALL SELECT [PropertyName] = N'TableHasTextImage', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has a text, ntext, or image column. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'TableHasTimestamp', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has a timestamp column. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'TableHasUniqueCnst', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has a UNIQUE constraint. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'TableHasUpdateTrigger', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'The object has an UPDATE trigger. 1 = True 0 = False Base data type: int'    UNION ALL SELECT [PropertyName] = N'TableHasVarDecimalStorageFormat', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table is enabled for vardecimal storage format. 1 = True 0 = False'    UNION ALL SELECT [PropertyName] = N'TableInsertTrigger', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has an INSERT trigger. >1 = ID of first trigger with the specified type. Base data type: int'     UNION ALL SELECT [PropertyName] = N'TableInsertTriggerCount', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'The table has the specified number of INSERT triggers. >0 = The number of INSERT triggers. Base data type: int'    UNION ALL SELECT [PropertyName] = N'TableIsFake', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table is not real. It is materialized internally on demand by the Database Engine. 1 = True 0 = False Base data type: int'     UNION ALL SELECT [PropertyName] = N'TableIsLockedOnBulkLoad', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table is locked because a bcp or BULK INSERT job. 1 = True 0 = False Base data type: int'      UNION ALL SELECT [PropertyName] = N'TableIsMemoryOptimized', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table is memory optimized 1 = True 0 = False Base data type: int For more information, see In-Memory OLTP (In-Memory Optimization). Applies to: SQL Server 2014 through SQL Server 2016.'   UNION ALL SELECT [PropertyName] = N'TableIsPinned', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table is pinned to be held in the data cache. 0 = False This feature is not supported in SQL Server 2005 and later versions.'    UNION ALL SELECT [PropertyName] = N'TableTextInRowLimit', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has text in row option set. > 0 = Maximum bytes allowed for text in row. 0 = text in row option is not set. Base data type: int'     UNION ALL SELECT [PropertyName] = N'TableUpdateTrigger', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has an UPDATE trigger. > 1 = ID of first trigger with the specified type. Base data type: int'    UNION ALL SELECT [PropertyName] = N'TableUpdateTriggerCount', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has the specified number of UPDATE triggers. > 0 = The number of UPDATE triggers. Base data type: int'   UNION ALL SELECT [PropertyName] = N'UserDataAccess', [PropertyAppliesToType] = N'Function, View', [PropertyDesc] = N'Indicates the object accesses user data, user tables, in the local instance of SQL Server. 1 = Read 0 = None Base data type: int'      UNION ALL SELECT [PropertyName] = N'TableHasColumnSet', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Table has a column set. 0 = False 1 = True For more information, see Use Column Sets.'   UNION ALL SELECT [PropertyName] = N'Cardinality', [PropertyAppliesToType] = N'Table (system or user-defined), view, or index', [PropertyDesc] = N'The number of rows in the specified object. Applies to: SQL Server 2012 through SQL Server 2016.'     UNION ALL SELECT [PropertyName] = N'TableTemporalType', [PropertyAppliesToType] = N'Table', [PropertyDesc] = N'Specifies the type of table. 0 = non-temporal table 1 = history table for system-versioned table 2 = system-versioned temporal table Applies to: SQL Server 2016 Community Technology Preview 2 (CTP2) through SQL Server 2016.'     
  ;

  --List all available object properties: 
  SELECT * FROM #tmpObjectPropertyEX_List ORDER BY 1, 2;

  --List all object properties for a given object:
  SELECT 
     objectName = isnull(SCHEMA_NAME(o.schema_id) + '.', '') + o.name
    , op.PropertyName
    , op.PropertyAppliesTo
    , PropertyValue = OBJECTPROPERTYEX(o.object_id, op.PropertyName)
    , o.*
  FROM sys.objects o 
    cross apply #tmpObjectPropertyEX_List op
  WHERE o.object_id = object_id('dbo.MyObjectName')
    and OBJECTPROPERTYEX(o.object_id, op.PropertyName) is not null
  ;

To recreate the value list:

  1. copy paste the HTML table from the MSDN URL above into Excel and select "match destination formatting" when pasting so that colspans are not copied. This will give you multiple rows per property, with the additional rows prefixed with 2 tab characters.
  2. copy all results from Excel into Notepad++ (if you copy directly into Notepad++ it does not include the 2 prefixed tabs on the additional rows per property).
  3. Find/Replace: "\r\n\t\t" with " " (two spaces). This moves everything to one row per property, with 3 columns
  4. Find/Replace any single quotes "'" with two single quotes "''" ...or "'" or something that does not break the SQL statement
  5. Paste back into Excel, and then add this formula in cell D of each row to build the Select SQL statement:
    =IF(ROW(A1)=1,"","UNION ALL ") & " SELECT [PropertyName] = N'"&A1&"', [PropertyAppliesToType] = N'"&B1&"', [PropertyDesc] = N'"&C1&"' "

  6. Copy/paste the Excel formula results from column D back into Notepad++, and find/replace: "\r\n" with "\t ", in order to get everything on one row.

  7. Copy/paste the 'SELECT' statement back into the insert statement below

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.