August 10, 2005 at 9:11 pm
hi all
got an old database here that needs to have an identity collumn added to some tables (currently uses multiple columns as a unique index for constraints!)
is there a sensible way of adding the identity column (easy: "alter table") but populating the column with data?
It doesn't matter what order the identity values are as long it has a unique integer for each record in the table (ie: not used in relationships)
thanx
barry.b
August 11, 2005 at 12:13 am
The column will automatically be populated with incrementing numbers when it is added.
But why would you need to add a column that will not be used? If you are looking to have a more narrow clustered index then sure, that is something to aspire, but remember that the clustered index does not need to be the primary key or even a unique index (though internally it will be uniqified of course).
August 11, 2005 at 12:41 am
>> The column will automatically be populated with incrementing numbers when it is added.
thanx! the idea of creating a temp table and selecting into that (and then changing the temp table name) seemed to be a long way to do it.
BTW: the index has to stay as is. it's a webapp remake (in ColdFusion) of an old client/server app. Schema changes can't break existing code.
It's for client-side "pesimistic datalocking" where "record_id" and "table_id" are passed back to the client and stored in a global scope. Part of the boss's grand plan to alert users that a record is unavailable for editing. Daft idea I know but at least I've got it working so far.
cheers
barry.b
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply