where do you use Isolations?give me some exmpale?
Answer / arunyadav007
Isolation Level controls the locking and row versioning
behavior of Transact-SQL statements issued by a connection
to SQL Server.
SET TRANSACTION ISOLATION LEVEL
{ READ UNCOMMITTED
| READ COMMITTED
| REPEATABLE READ
| SNAPSHOT
| SERIALIZABLE
}
READ UNCOMMITTED: Specifies that statements can read rows
that have been modified by other transactions but not yet
committed. This option has the same effect as setting
NOLOCK on all tables in all SELECT statements in a
transaction.
READ COMMITTED: Specifies that statements cannot read data
that has been modified but not committed by other
transactions. This prevents dirty reads. When the
READ_COMMITTED_SNAPSHOT database option is ON, you can use
the READCOMMITTEDLOCK table hint to request shared locking
instead of row versioning for individual statements in
transactions running at the READ_COMMITTED isolation level.
REPEATABLE READ: Specifies that statements cannot read data
that has been modified but not yet committed by other
transactions and that no other transactions can modify data
that has been read by the current transaction until the
current transaction completes.
SNAPSHOT: Specifies that data read by any statement in a
transaction will be the transactionally consistent version
of the data that existed at the start of the transaction.
The transaction can only recognize data modifications that
were committed before the start of the transaction. A
transaction running under SNAPSHOT isolation level can view
changes made by that transaction. For example, if the
transaction performs an UPDATE on a table and then issues a
SELECT statement against the same table, the modified data
will be included in the result set.
SERIALIZABLE: Specifies the following:
Statements cannot read data that has been modified but not
yet committed by other transactions.
No other transactions can modify data that has been read by
the current transaction until the current transaction
completes.
Other transactions cannot insert new rows with key values
that would fall in the range of keys read by any statements
in the current transaction until the current transaction
completes.
USE AdventureWorks;
GO
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
GO
BEGIN TRANSACTION;
GO
SELECT *
FROM HumanResources.EmployeePayHistory;
GO
SELECT *
FROM HumanResources.Department;
GO
COMMIT TRANSACTION;
GO
| Is This Answer Correct ? | 1 Yes | 0 No |
What is the difference between truncate and delete statement?
6 Answers CarrizalSoft Technologies, CTS,
What are the fixed server level roles? : sql server security
What are truncate options available in sql server? : sql server database administration
What is the difference between NOROW and LOCKROW?
0 Answers Accenture, Honeywell, Satyam,
What is sql injection and why is it a problem? : sql server security
How to override dml statements with triggers?
What happens if time-only values are provided as date and time literals?
What's the information that can be stored inside a bit column?
Is sql different from sql server?
Define right outer join?
I am Having tables T1 and T2 both having same data how to check (or) compare the data in both table are same?
What is 2nf normalization?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)