Attributes for SQL Server CLR Integration Database Projects and Database Objects
An attribute must be applied to each SQL Server project and to all database objects that a project contains. You can use the SQL Server Common Language Run-time integration (SQL CLR) to create the following types of objects:
Project / File | Attribute that must be applied |
|---|---|
Project | |
Aggregate | |
Stored Procedure | |
Trigger | |
User-defined Function | |
User-defined Type |
This attribute must be applied to trigger objects. This attribute has the following parameters:
Name - Optional. Specifies the name that is used on the SQL Server to reference the trigger.
Target - Required. Specifies the target to which the trigger applies. The type of target depends on the type of target that you create. You can create DDL, DML, or LOGON triggers. The most common type of trigger is applied to tables.
Event - Required. Specifies the action that activates the trigger.
This example specifies that the trigger is activated by updating existing data (UPDATE) in the table authors.
This example specifies that the trigger is referenced using the name trig_onpubinsert. The trigger is activated by adding new data (INSERT) to the table publishers.
This attribute must be applied to user-defined function objects, which return either a scalar value or a table. This attribute has the following parameters:
Name - Optional. Specifies the name that is used on the SQL Server to reference the user-defined function.
NoteFor functions that return a table value, you must specify a value for the TableDefinition property, which contains the Transact-SQL representation of the definition of the returned table.
This example specifies that the user-defined function is referenced using the name sp_scalarFunc.
This example specifies that the user-defined function is referenced using the name sp_tableFunc. The TableDefinition property has the value letter nchar(1).