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. Sql server deadlock issue with table bulk insert and update on same table

Sql server deadlock issue with table bulk insert and update on same table

Scheduled Pinned Locked Moved Database
databasesql-serversysadmincollaborationhelp
7 Posts 4 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.
  • K Offline
    K Offline
    kali siddhu
    wrote on last edited by
    #1

    HI Team,

    I am facing deadlock issue in the SQL Server. I have two process using the same table at same time. first process will insert the records using bulk insert and second process will update the records in the same table.

    Please could you let me know how can avoid deadlock.

    L Z 2 Replies Last reply
    0
    • K kali siddhu

      HI Team,

      I am facing deadlock issue in the SQL Server. I have two process using the same table at same time. first process will insert the records using bulk insert and second process will update the records in the same table.

      Please could you let me know how can avoid deadlock.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You need to synchronise the two processes. Or allow the bulk insert to finish before the updates start. See sql deadlock - Google Search[^].

      K 1 Reply Last reply
      0
      • L Lost User

        You need to synchronise the two processes. Or allow the bulk insert to finish before the updates start. See sql deadlock - Google Search[^].

        K Offline
        K Offline
        kali siddhu
        wrote on last edited by
        #3

        Is it better to use tab lock on the table during the bulk insert?

        L D 2 Replies Last reply
        0
        • K kali siddhu

          Is it better to use tab lock on the table during the bulk insert?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Sorry, I don't know. Check the documentation to see what it recommends.

          1 Reply Last reply
          0
          • K kali siddhu

            Is it better to use tab lock on the table during the bulk insert?

            D Offline
            D Offline
            David Mujica
            wrote on last edited by
            #5

            If you are using a script to initiate the bulk load, at the end of the script start the process for updating. That is a simple way of synchronizing the processes. :java:

            K 1 Reply Last reply
            0
            • K kali siddhu

              HI Team,

              I am facing deadlock issue in the SQL Server. I have two process using the same table at same time. first process will insert the records using bulk insert and second process will update the records in the same table.

              Please could you let me know how can avoid deadlock.

              Z Offline
              Z Offline
              ZurdoDev
              wrote on last edited by
              #6

              Do one then do the other.

              Social Media - A platform that makes it easier for the crazies to find each other. Everyone is born right handed. Only the strongest overcome it. Fight for left-handed rights and hand equality.

              1 Reply Last reply
              0
              • D David Mujica

                If you are using a script to initiate the bulk load, at the end of the script start the process for updating. That is a simple way of synchronizing the processes. :java:

                K Offline
                K Offline
                kali siddhu
                wrote on last edited by
                #7

                Both process are different based to the file availability process will kick start. Monthly I am getting deadlock issue when both the files are available at same time by utilizing the same table. As per my knowledge, I need to set lock/ Isolation level at store procedure to overcome this issue.

                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