Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Location
    Jakarta, Indonesia
    Posts
    9

    Unanswered: How to handle FK when using Logical Delete ?

    Hi SQL Gurus,

    In one project I MUST do 'Partial LOGICAL Delete' to Transaction. ALL Transactions have 2 types :
    Type 1 : Logical Deleted , Get status CANCELLED.
    Type 2 : The transaction physically DELETED.

    Create Table Orders
    (OrderNo Int Identity Primary Key,
    DocType int,
    DelStatus Char(1))
    -- DocType -> 1:Logical Delete or 2:Physical Delete


    Create Table DeliveryNote
    (DeliveryNo Int Identity Primary Key,
    DocType int, -- 1:Logical Delete or 2:Physical Delete
    DelStatus Char(1),
    OrderNo Int Foreign Key References Orders(OrderNo))
    -- DocType -> 1:Logical Delete or 2:Physical Delete

    If user (logical) delete DeliveryNote, I should empty OrderNo column right ?
    since it is FK, Should I create 'Dummy' empty OrderNo in Orders table ?
    What if Orders type 2 is Referred by DeliveryNote type 1 ?
    How should I handle this situation ?

    Thank you for any help,
    Krist

  2. #2
    Join Date
    Sep 2003
    Posts
    69
    Are you trying to make functionality so that you can delete (hide) things?

Posting Permissions

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