Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 20th, 2007, 01:39 AM
Friend of Wrox
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default primary key contraint

my member master table have a field called memberID which is referenced key to many tables. when i try to delete a record from membermaster table it shows error of reference key.
i want to know command or option which can be added in the table to ignore the reference key for deletion.

Reply With Quote
  #2 (permalink)  
Old September 26th, 2007, 01:38 PM
SQLScott's Avatar
Wrox Author
Join Date: Dec 2004
Location: Wellington, FL , USA.
Posts: 338
Thanks: 0
Thanked 2 Times in 2 Posts

You can't. This is what relational data is all about. If you deleted the member master record, you would then have records in related tables that reference a value that no longer exists.

Well, i said you can't, but if you make some changes you can. You can change the relationship to include CASCADE DELETE (you'll have to drop and recreate the relationship between the member master table and the other related tables). This will let you delete the record from the member master table, but then it will also delete all reldated records in referened tables.

You can do that, or, you can remove the relationships all togehter (I WOULD NOT RECOMMEND THIS).

Again, this is what relational databases is all about. Keep the integrity of the data clean.

Hope this helps...

Scott Klein
Author - Professional SQL Server 2005 XML
Reply With Quote

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 Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Foreign key not updating with Primary key xavier1945 BOOK: Access 2003 VBA Programmer's Reference 2 July 4th, 2007 09:48 PM
Primary key cf2006 BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 July 31st, 2006 07:21 PM
FOREIGN KEY and PRIMARY KEY Constraints junemo Oracle 10 June 15th, 2004 01:00 AM

All times are GMT -4. The time now is 10:13 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.