Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Primary Key - Help

Author  Topic 

cindylee
Yak Posting Veteran

55 Posts

Posted - 2005-02-13 : 19:46:38
Hi guys,
Is there any way to alter a primary key without deleting the existing relationship.

Thanks
Cindy

nr
SQLTeam MVY

12543 Posts

Posted - 2005-02-13 : 20:39:02
You mean is there a
alter table alter constraint
command?
No.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

cindylee
Yak Posting Veteran

55 Posts

Posted - 2005-02-14 : 00:16:25
NR,
I have a Column (PID) as primary key in a table
I want to include another column(pdesc) to the primary key .. Composite Primary key (PID,pdesc).
when i tried to include another column as primary key..it coming up with error "The Primary key or unique constraint cannot be changed until th existing realtionship is deleted"....
Also is there anyway to rebuild the relationship between tables without doing it manually..

Cindy

Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2005-02-14 : 01:12:11
Have you tried going to enterprise manager and getting it to generate a change script? Don't know whether that scripts the FK changes as well but it might.
Actually I doubt it as you will have to include the new column in the FK as well and it won't know which refers to it. Thisk you'll have to do the drops and creates yourself.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -