Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 INSERT WITH(NOLOCK)

Author  Topic 

Becio
Starting Member

4 Posts

Posted - 2008-06-17 : 05:31:13
just curios, will this be supported on the new version?

ty

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-06-17 : 05:41:49
No. Because you will lose data integrity in that case.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Becio
Starting Member

4 Posts

Posted - 2008-06-17 : 09:38:47
No, if used in a controlled way, ie enabled only by the hint.

Use case:

[ main procedure ]

begin tran
-- (preamble, setup the environment)
insert table with(nolock) (col1, coln) values (val1, valn)
...
-- (body)
.
. - - - -> [ external procedure ]
.
-- (restore the environment)
rollback tran

[ external procedure ]

(new connection)
begin tran
select * from table -- i want to see the current environment, ie uncommitted records
/insert/update table2
.
.
.
commit tran


Currently the simplest way to accomplish this is by using READ UNCOMMITTED isolation level in the external procedure, but this changes the whole behavior of the inner transactions, other way could be to apply the nolock hint to the select statements but there could be tons of change to do.. hey, i just want to insert a row with no lock!
Go to Top of Page
   

- Advertisement -