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 .
  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.
    Name Specify a name for the default.
    Default Expression Enter 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 DDL for creating the default.
  5. Click Next, and specify save and execution properties for the default.
    Field Description
    Generate Script 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 Default 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


Created June 25, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com