Default Object

Microsoft SQL Server의 이후 버전에서는 이 기능이 제거됩니다. 새 개발 작업에서는 이 기능을 사용하지 말고, 현재 이 기능을 사용하는 응용 프로그램은 수정하십시오.

The Default object represents the attributes of a single default in Microsoft SQL Server 2000 or later. SQL Server defaults provide data to columns and user-defined data types when no other data is available on an INSERT statement execution.

현재 개체를 보여 주는 SQL-DMO 개체 모델

Properties

CreateDate Property

Owner Property (Database Objects)

ID Property

Text Property

Name Property

 

Methods

BindToColumn Method

Remove Method (Objects)

BindToDatatype Method

Script Method

ListBoundColumns Method

UnbindFromColumn Method

ListBoundDatatypes Method

UnbindFromDatatype Method

주의

SQL Server defaults allow a non-redundant method of default-value specification. SQL Server columns can contain a DEFAULT constraint, but each column receiving a specific default value must be constrained to receive it. Alternately, a single default can be created and then bound to columns or user-defined data types, allowing the developer to specify the default value one time.

With the Default object, you can:

  • Create a SQL Server default.
  • Bind or unbind an existing SQL Server default to a column or user-defined data type.
  • Remove a SQL Server default from a database.

The Name property of a Default object uses the SQL Server data type sysname. The value of the Name property must be unique within a SQL Server database when constrained by the value of the Owner property.

To create a SQL Server default

  1. Create a Default object.

  2. Set the Name property.

  3. Set the Text property to establish the default value generated for an INSERT statement. The value of the Text property must match the constraints of the constant_expression parameter of the CREATE DEFAULT statement. For more information about how to set the Text property, see CREATE DEFAULT(Transact-SQL).

  4. Add the Default object to the Defaults collection of a connected Database object.

After the SQL Server default has been created, use the BindToColumn and BindToDatatype methods of the Default object to bind the SQL Server default to SQL Server columns and user-defined data types.

[!참고] The Default object is compatible with SQL Server 7.0 and later. However, the Default2 object extends the functionality of the Default object for use with features that were introduced in SQL Server 2000.

참고 항목

참조

Default2 Object

도움말 및 정보

SQL Server 2005 지원 받기