Lock and Unlock Tables

  • Hi

    I want to know how to lock and unlock tables in sql server 2005

    it is possible or not? possible then how please reply me.

    Guru.K:-D

  • What, precisely, are you trying to achieve?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • HI

    Just want to know it is possible or not.

    guru:-)

  • HI

    Just want to know it is possible or not.

    guru:-)

  • What do you mean by 'Lock the table' ?

  • HI,

    Thats why i am asking qustion

    Thats my qustion any possiblities is there lock the table or not.

    It is possible then how?

    Guru.K:-P

  • there's two ways I can think of to interpret "lock the table", which is why we ask.

    you can "lock the table" with permissions, so noone, or noone but an sysadmin has access to a table. typically I would create a role, specifically set DENY permissions to the table for that role, and then start adding people to the role so they cannot do anything to the table.

    another meaning for "lock the table" is to start a transaction, then do something like

    SELECT * FROM TABLE WITH(TABLOCKX) --exclusive table lock

    then, I think noone can fiddle with the table until you commit your transaction.

    now with that in mind, be very specific and tell us what you meant by "lock the table"..was it something else?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply