Some Facts About UDFs

UDFs can be embedded in queries, constraints, and computed columns. The code that defines a UDF may not cause side effects that affect the database state outside the scope of the function–that is, the UDF’s code is not allowed to modify data in tables or to invoke a function that has side effects (for example, RAND). In addition, the UDF’s code can only create table variables and cannot create or access temporary tables. Also, the UDF’s code is not allowed to use dynamic execution.

When creating or altering a UDF, you can specify function options in the header. T-SQL UDFs support the ENCRYPTION and SCHEMABINDING options, which I described in the previous chapter when discussing views. Both T-SQL and CLR UDFs can be created ...

Get Inside Microsoft® SQL Server™ 2005 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.