Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. how can delete data without drop relation ship between tables???

how can delete data without drop relation ship between tables???

Scheduled Pinned Locked Moved Database
helpquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rami Said Abd Alhalim
    wrote on last edited by
    #1

    i have to delete data but i have problem found relation between tables so i cant delete data how can delete data without drop relation ship between tables??? Rami Abd Alhalim

    K D 2 Replies Last reply
    0
    • R Rami Said Abd Alhalim

      i have to delete data but i have problem found relation between tables so i cant delete data how can delete data without drop relation ship between tables??? Rami Abd Alhalim

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      If I am understanding you correctly, you can not do this. That is the purpose of the foreign key constaint. It will not allow you to delete the data without dropping the relationship between the tables. The only other options is to delete data from all the tables in the correct sequence. Hope that helps. Ben

      R 1 Reply Last reply
      0
      • R Rami Said Abd Alhalim

        i have to delete data but i have problem found relation between tables so i cant delete data how can delete data without drop relation ship between tables??? Rami Abd Alhalim

        D Offline
        D Offline
        divyesh1432
        wrote on last edited by
        #3

        set particular column's constraint as Delete Rule as Set null and Update Rule as Set null You can find this option where you define the relationship of tables. it is titled with "Insert and Update Specification" of sql server management studio. divyesh

        1 Reply Last reply
        0
        • K kubben

          If I am understanding you correctly, you can not do this. That is the purpose of the foreign key constaint. It will not allow you to delete the data without dropping the relationship between the tables. The only other options is to delete data from all the tables in the correct sequence. Hope that helps. Ben

          R Offline
          R Offline
          Rami Said Abd Alhalim
          wrote on last edited by
          #4

          Thanks how correct sequence

          K 1 Reply Last reply
          0
          • R Rami Said Abd Alhalim

            Thanks how correct sequence

            K Offline
            K Offline
            kubben
            wrote on last edited by
            #5

            It depends on how your tables are related. Let's say you had: ParentTable1 ChildTable1 ChildTable2 Both ChildTable1 and ChildTable2 have parenttable1ID which is the key. All of the records in childTable1 and childTable2 that have that parenttable1ID must be deleted before the record in ParentTable1 with parenttable1id can be deleted. The benifit of this is that you can't orphen the Child table records. They must be deleted before the parent table record can be deleted. Hope that helps. Ben

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups