Creating an inline shared default

Use create table, alter table. . . add, and alter table. . . replace to create shareable inline defaults.

Adaptive Server automatically creates and uses sharable inline defaults when the default clause is used in create table or alter table commands. See the Reference Manual: Commands.

For example, if you create this table:

create table my_titles
(title_id char(6),
title    varchar(80),
moddate  datetime default '12/12/2012')

Then create a second table with the same default:

create table my_authors2
(auth_id char(6),
title    varchar(80),
moddate  datetime default '12/12/2012')

sysobjects reports a single default shared between the two:

select id, name from sysobjects where type = 'D'
 id          name
 ----------- ---------------------------
 1791386948  my_titles_moddat_1791386948

Use sp_helpconstraint to view the definition for a shareable inline default object:

sp_helpconstraint my_titles
name                              defintion              created
-------------------------------   -------------------    ---------------
my_titles_moddate_1791386948      DEFAULT '12/12/2012'   Dec 6 2010 10:55AM


sp_helpconstraint my_authors2
name                              defintion             created
-------------------------------   -------------------   ----------------
my_titles_moddate_1791386948      DEFAULT '12/12/2012'   Dec 6 2010 10:55AM

my_titles and my_authors2 show the same internal default name, my_titles_moddate_1791386948, which indicates there is a single default object shared between these columns. sp_help also shows the defaults associated with columns.