Creating a Default

Create a database default to specify a value to insert in a column (or in all columns of a user-defined datatype) if no value is explicitly supplied at insert time.

Prerequisites 

Before you create a default, be sure the data server for which you are creating a default is running and that you created and established a connection to the data server.

  1. In the Database Development perspective, select File > New > Database Schema Object to launch the New Schema Object wizard.
  2. In the New Schema Object wizard, select the database server type, connection profile name, and database name in which to create the default.
  3. In the Wizards field, select New Default, and click Finish.
  4. Specify properties for the new default.
    Field Description
    Owner Select an owner from the drop-down menu.
    Name Specify a name for the default in the corresponding text field.
    Default expression This is an editable field for entering the default constant expression. The expression cannot include the names of any columns or other database objects. It can include global variables and built-in functions that do not reference database objects. Enclose character and date constants in quotes and use a "0x" prefix for binary constants. For example, to assign the current date to a default named todays_date , enter getdate() as the default expression.
    Preview This field displays the DDL for creating the default.
  5. Click Next, and specify save and execution properties for the default.
    Field Description
    Generate script Select this option to generate DDL for the default.
    Enter or select the parent folder Specify an existing project or create a new project in which to save the DDL.
    File name Enter the name of the file in which to store the DDL.
    Execute immediately Execute the DDL immediately. If you do not select this option, you must complete execution of the DDL later to create the default.
    Open in editor after creation Create the default, and then open it in the Defaults Editor.
  6. Click Finish to create the default.
Related tasks
Editing Table Schema Data
Creating an ASE Rule
Editing a Default
Dropping a Default
Renaming a Default
Opening a Referenced Database Object

Send your feedback on this help topic to Sybase Technical Publications: pubs@sybase.com

Your comments will be sent to the technical publications staff at Sybase, Inc. For product-related issues or technical support, contact Sybase Technical Support at 1-800-8SYBASE.