Results 1 to 7 of 7
  1. #1
    Join Date
    May 2007

    Unanswered: database Design Idea

    Good morning
    In messages system i have table to store messages and another table to contain the links which the message is posted through
    Now i want to delete a link but i don't want to delete the message sent through this link
    The problem:
    When displaying the message sent what will be found in the link field (i.e. for the deleted link)

    If any one has a good idea for doing that please reply to me
    I don’t want the sql code
    I want just the idea

    kind regards
    mohammed Al Maghraby

  2. #2
    Join Date
    Jun 2004
    Arizona, USA
    Is this a one-to-one relationship? one message for one link? Or, could one link refer to many messages? Or vice-versa.
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert

  3. #3
    Join Date
    May 2007
    it is one to many relationship
    one link can be used for many massages

  4. #4
    Join Date
    Apr 2002
    Toronto, Canada
    one link can be used for many messages

    therefore the message has a foreign key to the link

    now you delete the link, and you want the message to remain

    and you're asking what will be found in the link

    the answer: whatever you defined in the foreign key's ON DELETE option

    in sql server 2000, the ON DELETE options are CASCADE (which you don't want) and NO ACTION (which would prevent the delete), so in sql server 2000, you can't do what you want with a foreign key!!

    in sql server 2005, the ON DELETE options are NO ACTION, CASCADE, SET NULL, and SET DEFAULT (more in line with the various options defined by the sql standard)

    helps? | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    May 2007
    First Thanks for interest

    There is misunderstanding in the problem
    I have to enable the user to add a link with the same name because the original link supposed to be deleted
    I.e. it doesn't appear in the forms of the application
    So the user thinks that the link was deleted

    i want to delete the link because it became useless for me but at the same time there are messages in the message table which are related to that link
    And I don't want to delete them
    Also at the same time after deleting the link the user wants to view a report about the messages which contain information about the link used for sending these messages
    , after deleting the link where could I get the link information?...because the message link data is very importatnt to me to know ............ that is the problem

    I hope the situation is clear

    Again thanks for interest

    Kind regards

    Mohammed Al Maghraby

  6. #6
    Join Date
    Dec 2006
    Momence, IL USA
    It sounds like you might want a sort of archive or history table. Just have a "deleted_links" table. The messages can remain in the messages table, they will just relate to the link you move to the deleted_links table. Or you could add a "current" field to the links table. Instead of deleting the link, you would set current to false.
    Is that what you mean?
    Don't Bogart That Squishee!

  7. #7
    Join Date
    Jan 2007
    Provided Answers: 12
    Quote Originally Posted by modiagag
    I have to enable the user to add a link with the same name because the original link supposed to be deleted
    Is "LinkName" (or equivalent) your primary key?
    Home | Blog

Posting Permissions

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