i have 2 sybase databases.
1 used for production and 1 use for development.
all my tables have an autonumber primary key.
recently, i've taken a project of upgrading the software so that we have centralized management for many branches. and i need to add a second primary key called branchid on some of the tables.
normally when i do this in the gui i follow these steps.
1. add the new column branchid to the table (ofcourse it has to be not null because the table already has data)
2. update tablename set branchid=0 (or any value that i want)
3. modify the table so that it doesnt allow null values
4. set it as primary key (keeping the primary autonumbered pkey as well)
doing this programmatically:
1. i'm adding the column using alter table add column branchid null << successful
2. update table set branchid=0 << success
3. alter table tablename modify column branchid not null << success
4. alter table tablename add primary key (branchid) << i get an error saying that table already has a primary key
what is the syntax of altering a table from 1 pkey structure to a composite pkey structure??
i appreciate your help,
p.s. i dont wanna look cheap, but this question is urgent and 95 points are all i have left on my account.