Click here to Skip to main content
15,890,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends
I have a column name StudentId. Its a primary key and foreign key for some tables. Now I want to change the name of the Primary key like AdmissionNumber. Is it possible to change this name?
Thank you
Posted
Comments
veenusethi 25-Oct-12 7:55am    
you can use it use as clause.

I do not recommend changing an existing table column name.

To change the column name you would have to drop the foreign key, drop the primary key constraint, not to mention all indexes as they are built on the primary key. You would then change the column name and rebuild everything you dropped.

Question, why do you need to change the column name and access to the column can change the name using alias?
 
Share this answer
 
Drop the existing key and recreate after changing the column name , but i will not
recommend.

Thanks,
Ambesha
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900