sqlserver--Transaction One programming advanced (SQL Server Technology Insider T-SQL Programming Chapter Nineth

Source: Internet
Author: User

Generally do not modify the default level of SQL Server transactions. Forced lock is not recommended

1 Execute EXEC sp_lock report information about the lock

1 How to lock a row in a table

SET TRANSACTION Isolation Level READ UNCOMMITTED

SELECT * FROM table rowlock WHERE id = 1

2 locking a table for a database

SELECT * from table with (HOLDLOCK)

Add lock Statement:

Sybase:

Update table set col1=col1 where 1=0;

MSSQL:

Select col1 from table (Tablockx) where 1=0;

Oracle

LOCK table table in EXCLUSIVE MODE;

Locking after the other person is not operational until the lock user unlocked, with a commit or rollback unlock

sqlserver--Transaction One programming advanced (SQL Server Technology Insider T-SQL Programming Chapter Nineth

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.