Answer:
You can either create your table initially with the identity column:
1. create table ident_test
2. (text_field varchar(10),
3. ident_field numeric(5,0) identity)
4. go
Or alter an existing table and add an identity column:
1. alter table existing_table
2. add new_identity_field numeric(7,0) identity
3. go
When you alter a table and add an identity column, the System locks the table while systematically incrementing and adding unique values to each row. IF YOU DON'T SPECIFY a precision, Sybase defaults the size to 18! Thats 1,000,000,000,000,000,000-1 possible values and some major major problems if you ever crash your ASE and burn a default number of values... (10^18 with the default burn factor will burn 5^14 or 500,000,000,000,000 values...yikes).
1. create table ident_test
2. (text_field varchar(10),
3. ident_field numeric(5,0) identity)
4. go
Or alter an existing table and add an identity column:
1. alter table existing_table
2. add new_identity_field numeric(7,0) identity
3. go
When you alter a table and add an identity column, the System locks the table while systematically incrementing and adding unique values to each row. IF YOU DON'T SPECIFY a precision, Sybase defaults the size to 18! Thats 1,000,000,000,000,000,000-1 possible values and some major major problems if you ever crash your ASE and burn a default number of values... (10^18 with the default burn factor will burn 5^14 or 500,000,000,000,000 values...yikes).
Previous Question | Next Question |
How can I execute dynamic SQL with ASE in Sybase? | How do I Configure the burn factor in Sybase? |