Previous Topic: Define SQL Server XML Schema CollectionsNext Topic: Define Data Compression for Tables, Table Indexes, or View Indexes in SQL Server 2008


Define the Code Type for an Object in a SQL Server Property Editor

You can define the code to use for actions of certain SQL Server objects using the Code tab in the object's property editor. You can also edit SQL code related to certain SQL Server objects. For example, if you click the Code tab in the SQL Server Table Trigger Editor, you can define the type of code to use to implement the table trigger, and have the option to edit the table trigger's SQL code.

To define the code type for an object in a SQL Server property editor

  1. Open the property editor for the object for which you want to define the code type, and select the object in the Navigation Grid.
  2. Click the Code tab and work with the following options:
    Code Type

    Specifies the type of code based on the SQL Server object with which you are working. Select one of the following from the drop-down list:

    SQL

    Specifies to use SQL code for the selected SQL Server object.

    Assembly

    Specifies to use Common Language Runtime code defined in an assembly for the selected SQL Server object.

    CLR

    Specifies the Common Language Runtime properties for the selected SQL Server object. Work with the following options to specify these properties:

    Note: This option is not available if the code type is SQL.

    Assembly

    Specifies the assembly that contains the code to implement the selected SQL Server object. Select an assembly from the drop-down list, or click the New icon to open the SQL Server Assembly Editor and create one.

    Note: The assembly must exist in the same database as the selected SQL Server object.

    Class Name

    Defines the class within the selected assembly required to implement the code for the selected SQL Server object. Enter the class name in this field.

    Note: The class name you enter must contain the method you define in the Method Name field.

    Method Name

    Defines the method in the class of the assembly for the selected SQL Server object. Enter the method name in this field.

    SQL

    Defines the SQL code. You can edit the SQL code in this area using the icons to cut, copy, or paste text, or to work with the Text Editor. To add an ERwin macro, click the Macro Editor icon to open the Macro Toolbox.

    Note: This option is not available if the code type is Assembly.

  3. Click Close.

    The code type is defined for the selected object and the property editor closes.