sql server 2008 r2 - How to using UPDATE and SELECT in one Transaction SQL -


i have table: [dbo].[product] data :

id	        name  01        	keyboard  02        	monitor  03        	mouse  04        	ram  05        	hdd

and : have 1 transaction:

begin tran        update product set name = 'xxx' id = 01        select name name_in_trans product id = 01  commit tran        select name name_out_trans product id = 01

result:

name_in_trans  xxx    name_out_trans  xxx

i don't know result correct or incorrect ! me , explain it, !

the first select within same transaction update, see non-committed data in transaction - in case, xxx value. second select after transaction committed, @ point query should see updated data. long story short - both queries should see xxx, expected behavior.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -