If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > modify or change primary key??

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-18-09, 23:09
sandyssn sandyssn is offline
Registered User
 
Join Date: Feb 2009
Posts: 7
modify or change primary key??

can primary key be modified or changed? as far as i have seen there were no options to change or modify. it can only be dropped and added! if its true please tell me why it cant be modified or changed?
thanks n cheers!
Reply With Quote
  #2 (permalink)  
Old 02-19-09, 01:18
ankur02018 ankur02018 is offline
Registered User
 
Join Date: Jun 2007
Posts: 189
Smile

Quote:
Originally Posted by sandyssn
can primary key be modified or changed? as far as i have seen there were no options to change or modify. it can only be dropped and added! if its true please tell me why it cant be modified or changed?
thanks n cheers!
Primary cannot be modified due to this will be refrence to many other table
You have to make lots of modification
Reply With Quote
  #3 (permalink)  
Old 02-19-09, 01:39
bklr bklr is offline
Registered User
 
Join Date: Dec 2008
Posts: 133
if u want to drop the primary key u have to drop the foreign key constraint which references with primary key and then drop the primary key constriant
Reply With Quote
  #4 (permalink)  
Old 02-19-09, 07:14
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Quote:
Originally Posted by ankur02018
Primary cannot be modified due to this will be refrence to many other table
actually, that's not true

do a search for ON UPDATE CASCADE

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #5 (permalink)  
Old 02-19-09, 08:05
ankur02018 ankur02018 is offline
Registered User
 
Join Date: Jun 2007
Posts: 189
Smile

Quote:
Originally Posted by r937
actually, that's not true

do a search for ON UPDATE CASCADE

I understood for changes in primary key column name or data type
which can also be change by droping and recreating reference key
Reply With Quote
  #6 (permalink)  
Old 02-19-09, 08:25
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,609
Quote:
Originally Posted by r937
actually, that's not true

do a search for ON UPDATE CASCADE

From the data perspective that's true, but I think the question was intended from the schema perspective. Thats a different problem.

-PatP
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On