The DRIDefault object represents the properties of a Microsoft® SQL Server™ column DEFAULT constraint.
The SQL Server column DEFAULT constraint is used to generate data for the column when none is supplied by the user on INSERT statement execution. With the DRIDefault object, you can:
The Name property of the DRIDefault object uses the SQL Server data type sysname. Name is optional when using the object to create a DEFAULT constraint for a SQL Server column. When Name is not specified, SQL-DMO will generate an appropriate value.
When setting the Text property of a DRIDefault object, specify only the text for the default. You do not need to build the constraint clause because SQL-DMO does that. The Text property value must evaluate to a constant. For more information about limitations on the Text property, see the description of the DEFAULT constraint in CREATE TABLE.
Delimiters that specify constant strings must be present in the Text property value when specifying string data as part of the property. For example, to specify the string “unknown” as the default, use 'unknown'.
To set a DEFAULT constraint on a new SQL Server column
To set a DEFAULT constraint on an existing SQL Server column
Remove Method (Objects) | Script Method |
Name Property | Text Property |
Column Object | Table Object |