Skip to content

Latest commit

 

History

History
75 lines (51 loc) · 3.85 KB

clr-integration-custom-attributes-for-clr-routines.md

File metadata and controls

75 lines (51 loc) · 3.85 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic helpviewer_keywords
CLR Integration: Custom Attributes for CLR Routines
Custom attributes can be applied to CLR routines, user-defined types, and user-defined aggregates that are registered in Microsoft SQL Server.
rwestMSFT
randolphwest
12/27/2024
sql
clr
reference
routines [CLR integration]
SqlFacet attribute
SqlTrigger attribute
SqlProcedure attribute
custom attributes [CLR integration]
SqlUserDefinedAggregate attribute
attributes [CLR integration]
SqlMethod attribute
SqlFunction attribute
common language runtime [SQL Server], attributes
SqlUserDefinedTypeAttribute attribute

CLR integration: custom attributes for CLR routines

[!INCLUDE sql-asdbmi]

The attributes listed can be applied to common language runtime (CLR) routines, user-defined types, and user-defined aggregates that are registered in [!INCLUDE ssNoVersion]. If the attribute isn't applied, [!INCLUDE ssNoVersion] assumes the default value. The attributes listed are defined in the Microsoft.SqlServer.Server namespace.

The SqlUserDefinedAggregate attribute

The SqlUserDefinedAggregate attribute indicates that the method should be registered as a user-defined aggregate. Every user-defined aggregate must be annotated with this attribute.

For more information, see SqlUserDefinedAggregateAttribute.

The SqlFunction attribute

The SqlFunction attribute indicates the method should be registered as a function, with the appropriate function attributes set.

For more information, see SqlFunctionAttribute.

The SqlFacet attribute

The SqlFacet attribute is used to return information about the return type of a user-defined type (UDT) expression.

For more information, see SqlFacetAttribute.

The SqlProcedure attribute

The SqlProcedure attribute indicates the method should be registered as a stored procedure. This attribute is used only by Visual Studio to register the specified method as a stored procedure automatically; it isn't used by [!INCLUDE ssNoVersion].

The SqlTrigger attribute

The SqlTrigger attribute indicates the method should be registered as a trigger.

For more information, see SqlTriggerContext.

The SqlUserDefinedTypeAttribute

You can apply the SqlUserDefinedTypeAttribute to a class definition in the assembly. It causes [!INCLUDE ssNoVersion] to create a user-defined type that is bound to the class definition that has this custom attribute.

For more information, see SqlUserDefinedTypeAttribute.

The SqlMethod attribute

The SqlMethod attribute is used to indicate the determinism and data access properties of a method or a property on a UDT.

For more information, see SqlMethodAttribute.

Related content