SQL Server Problem... HELP!!!

Results 1 to 2 of 2

Thread: SQL Server Problem... HELP!!!

  1. #1
    Join Date
    Dec 1969

    Default SQL Server Problem... HELP!!!

    SQL Server 2k, Win2k<BR><BR>I have 2 tables, Members and Books. Each member has can post book so I setup a relationship between the Members and Books table joining them with the MemberID column. I setup the relationship to do automatic updates and deletes (When i delete a member, i want his books to be gone). I also created a trigger on Members and a trigger in Books so that the tuples are backup in a DeletedMembers and DeletedBooks table.<BR><BR>Problem:<BR>When i try delete a member, the trigger raises an error:<BR> Cannot insert NULL into the Price column, table<BR> Database.dbo.DeletedBooks; column does not allow<BR> nulls.<BR>What i understand from this error is that the relationship is trying to delete books for any member, even if there isn&#039;t a book associated with that member. I really don&#039;t know why this is happening. The code itself is fine, i checked it 3,781 times. The problem must lie between the relationships and the automatic cascade deletes. ....oh and yes, one more thing... HEEEEEEEEEELP!!!!! :(

  2. #2
    Join Date
    Dec 1969

    Default RE: SQL Server Problem... HELP!!!

    one thing i like to do in such a situation is to just keep the 2 tables you have an add a bit (1 or 0) field marking whethere the record is active or not.<BR><BR>It won&#039;t be a performance problem if your tables are well normailized and indexed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts