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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. How to Optimize DbTransactions (C#) with SQLServer ?

How to Optimize DbTransactions (C#) with SQLServer ?

Scheduled Pinned Locked Moved Database
databasequestioncsharpsql-serversysadmin
4 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.
  • K Offline
    K Offline
    kadaoui el mehdi
    wrote on last edited by
    #1

    Hello, I have to Update a Csv file into Sql Server DataBase, the file contains 200 000 records. So how can i do to optimize the DbTransactions ?! because 200 000 is too big and i want not overload the Database Server. Solution1: create a global DbTransaction with IsolationLevel=RaadUncommited Solution2: create a DbTransaction foreach Record with IsolationLevel=RaadUncommited Solution3: create a DbTransaction for a group of Records with IsolationLevel=RaadUncommited Already Thanks.

    E N 2 Replies Last reply
    0
    • K kadaoui el mehdi

      Hello, I have to Update a Csv file into Sql Server DataBase, the file contains 200 000 records. So how can i do to optimize the DbTransactions ?! because 200 000 is too big and i want not overload the Database Server. Solution1: create a global DbTransaction with IsolationLevel=RaadUncommited Solution2: create a DbTransaction foreach Record with IsolationLevel=RaadUncommited Solution3: create a DbTransaction for a group of Records with IsolationLevel=RaadUncommited Already Thanks.

      E Offline
      E Offline
      Enver Maroshi
      wrote on last edited by
      #2

      What do you mean by "update" csv into database? You update records in place, or insert new ones? Look at BULK INSERT at MSDN. It is very fast, you can insert all in temp table and then update records, if that is your goal.

      K 1 Reply Last reply
      0
      • E Enver Maroshi

        What do you mean by "update" csv into database? You update records in place, or insert new ones? Look at BULK INSERT at MSDN. It is very fast, you can insert all in temp table and then update records, if that is your goal.

        K Offline
        K Offline
        kadaoui el mehdi
        wrote on last edited by
        #3

        thank you for you answer. I update a record. I know the BULK INSERT but the CSV file have to be in the same machine of Sql Server Data base!

        1 Reply Last reply
        0
        • K kadaoui el mehdi

          Hello, I have to Update a Csv file into Sql Server DataBase, the file contains 200 000 records. So how can i do to optimize the DbTransactions ?! because 200 000 is too big and i want not overload the Database Server. Solution1: create a global DbTransaction with IsolationLevel=RaadUncommited Solution2: create a DbTransaction foreach Record with IsolationLevel=RaadUncommited Solution3: create a DbTransaction for a group of Records with IsolationLevel=RaadUncommited Already Thanks.

          N Offline
          N Offline
          Niladri_Biswas
          wrote on last edited by
          #4

          Check out the following two articles. These are the best practices, I believe 1) http://www.sqlnetframework.com/DataAccessBlog/post/2008/11/07/Bulk-insert-in-SQL-Server-2005-using-ADONET-and-XML.aspx[^] 2) http://blog.sqlauthority.com/2008/02/06/sql-server-import-csv-file-into-sql-server-using-bulk-insert-load-comma-delimited-file-into-sql-server/[^] Hope this helps :)

          Niladri Biswas

          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