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. Locking a table in sqlserver 2000

Locking a table in sqlserver 2000

Scheduled Pinned Locked Moved Database
announcementdatabasetutorial
2 Posts 2 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.
  • U Offline
    U Offline
    Uma Kameswari
    wrote on last edited by
    #1

    Hi, I am writing a stored procedure. I want to update the records in a table. till i complete the updation of records I want to lock the table and once i complete the updation i want to release the lock on the table. during the process of updation of records i don't want any other methods to access this table. How to achieve this Regards, Uma

    C 1 Reply Last reply
    0
    • U Uma Kameswari

      Hi, I am writing a stored procedure. I want to update the records in a table. till i complete the updation of records I want to lock the table and once i complete the updation i want to release the lock on the table. during the process of updation of records i don't want any other methods to access this table. How to achieve this Regards, Uma

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      It happens automatically. As soon as you start making changes the table will get locked until the transaction is completed. Since SQL Server will wrap each statement in its own transaction, if you are updating over several SQL statements use Begin Transaction at the start and Commit Transaction when successfully finished.


      Upcoming Scottish Developers events: * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

      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