Referring to IDENTITY columns with syb_identity  Allowing null values in a column

Chapter 8: Creating Databases and Tables

Creating “hidden” IDENTITY columns automatically

System Administrators can use the auto identity database option to automatically include a 10-digit IDENTITY column in new tables. To turn this feature on in a database, use:

sp_dboption database_name, "auto identity", "true" 

Each time a user creates a new table without specifying a primary key, a unique constraint, or an IDENTITY column, Adaptive Server automatically defines an IDENTITY column. The IDENTITY column is not visible when you use select * to retrieve all columns from the table. You must explicitly include the column name, SYB_IDENTITY_COL (all uppercase letters), in the select list. If Component Integration Services is enabled, the automatic IDENTITY column for proxy tables is called OMNI_IDENTITY_COL.

To set the precision of the automatic IDENTITY column, use the size of auto identity configuration parameter. For example, to set the precision of the IDENTITY column to 15 use:

sp_configure "size of auto identity", 15




Copyright © 2005. Sybase Inc. All rights reserved. Allowing null values in a column

View this book as PDF