Tuesday, October 13, 2009

Adding Column to Composite Primary Key

Below is the solution of Adding a column to a composite primary key once it had lacs of records.

1. Create a Table "TEST" with Composite Primary Key on Col1, Col2 and Col3.
2. Add some thousands of records to the table.
3. Alter the table and add the new column to the table as NOT NULL with some default value.
4. Alter the table and drop the composite Primary Key constraint.
5. Alter the table and add a composite primary key constraint with (Col1, Col2, Col3 and NEW_Colxxx)

Hope it will help to you. Please drop an email to me bhavik.fuletra@gmail.com if you have any other queries with regards to Composite Primary Key issue.

Thanks and pls dont forget to provide your comments.

2 comments:

How can I remove a URL on my website from the Google Index?

To remove a specific URL (for example, the page http://www.example.com/page4.html) of your own website from Google’s index, there are two ...