Sybase Defaults

Sybase defaults are used to insert into a column when the we does not explicitly enter a value for that column.

Steps involved in Sybase defaults creation

  • We can create default using create default syntax.
  • Then, we can bind the default to a table using sp_bindefault stored procedure.
  • Then, test the default by inserting data into respective table.

Default create syntax:

create default [owner.]default_name
as constant_expression

Example:

create default city_default
as “Elchuru”

Binding Defaults to a table column:

sp_bindefault city_default, “titles.city”

To unbind the default from a table:

execute sp_unbindefault “titles.city”

Dropping a default:

drop default default_name

Example:

drop default city_default

Powered by k2schools