Meta-data
Transact-SQL provides a handful of OBJECTPROPERTY() options for retrieving info about UDFs. They allow you to determine the specific type of UDF as well as whether a function is deterministic and/or schema bound. Table 10-1 summarizes these options:
Here's a query that demonstrates how these are used (Listing 10-6):
Listing 10-6. OBJECTPROPERTY() returns meta-data about UDFs.
SELECT LEFT(name,20) AS [Function], OBJECTPROPERTY(id,'IsScalarFunction') AS Scalar, OBJECTPROPERTY(id,'IsTableFunction') AS [Table], OBJECTPROPERTY(id,'IsInlineFunction') AS Inline, OBJECTPROPERTY(id,'IsDeterministic') AS Determ, OBJECTPROPERTY(id,'IsSchemaBound') AS SchemaBound FROM sysobjects WHERE type in ('IF','TF','FN') ORDER BY name |
(Results)
Function ...
Get Guru's Guide to SQL Server™ Stored Procedures, XML, and HTML, The now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.