O'Reilly logo

Guru's Guide to SQL Server™ Stored Procedures, XML, and HTML, The by Ken Henderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required