-2

In this query :

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
Select * from table1
Go
Select * from table2
Go

Does it mean that the READ UNCOMMITTED would gonna work only on the Select * from table1 becuase of the Go ?

And why this don't work?

declare @var varchar(20)

set @var = 'fdsdsf'

select 'var'
go
select @var

the go must eliminate in order for this to work

Emman Bangis
  • 85
  • 2
  • 6

2 Answers2

4

GO is a batch separator used by SSMS or SQLCMD. It is not part of the SQL standard and should not have an effect on ISOLATION LEVEL.

As per MSDN, "Only one of the isolation level options can be set at a time, and it remains set for that connection until it is explicitly changed." In your case, therefore, the READ UNCOMMITTED will work for both queries.

shree.pat18
  • 21,449
  • 3
  • 43
  • 63
-1

Go- This is used for execution and is used to Signals the end of a batch of Transact-SQL statements to the SQL Server utilities.. Nothing with Transaction or isolation level.

Read Uncommited is work for both query because it work for single transaction till the transaction open.(it is maintained by sqlserver, so don't worry)

Read Uncommited :- It is is SQL Server's default transaction isolation level.

Why use a READ UNCOMMITTED isolation level?

Specifies that statements can read rows that have been modified by other transactions but not yet committed.

Community
  • 1
  • 1
Ajay2707
  • 5,690
  • 6
  • 40
  • 58