Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQL Server2005 ÊÂÎñ¸ôÀ뼶±ð

ÈκÎÊÂÎñÎÞÂÛÆä¸ôÀ뼶±ðÈçºÎ£¬¶¼¾ßÓÐÔ­×ÓÐÔ¡£Ô­×ÓÐԺ͸ôÀ뼶±ðÊÇÁ½ÂëÊ¡£
¼Ù¶¨Ö»ÓÐÒ»ÖÖ×ÊÔ´Êý¾Ý±íÉϵēÐГ¿ÉÒÔ±»Ëø¶¨¡£ËøÖ»Óй²ÏíËøºÍÅÅËûËøÁ½ÖÖ¡£
ËøµÄ¼æÈÝÐÔ£º
  SX
S 10
X 00
ÊÂÎñµÄ¸ôÀ뼶±ð£º
Read Uncommitted
Êý¾Ý¶Áȡʱ²»ÐèÒªËø¶¨
Read Committed
Êý¾Ý¶ÁȡʱÐèÒª¹²ÏíËø¶¨
Repeatable Read
Êý¾Ý¶ÁȡʱÐèÒªÅÅËûËø
Serializable
ÊÂÎñ±ØÐëµÈͬÓÚ´®ÐÐÖ´ÐÐ
×¢ÒâÎÞÂÛÈκÎʱºò¸üÐÂÐж¼±ØÐëÒªÓÐÅÅËûËø¡£
²åÈëÐв»ÐèÒªËø¡£
ÔÚRead Committed¸ôÀ뼶±ðÏ£¬Êý¾Ý¶ÁÈ¡Íê±ÏºóÁ¢¼´ÊͷŹ²ÏíËø£¬¶øÔÚRepeatable Read¸ôÀ뼶±ðÏ£¬ÊÂÎñ±£³Ö¹²Ïí
ËøÖ±µ½Õû¸öÊÂÎñ½áÊø¡£
ÔÚSQL ServerÖе÷ÕûÊÂÎñ¸ôÀ뼶±ðÊÇÕë¶Ô»á»°µÄ£¬set tran isolation levelºó£¬»á»°ÖкóÀ´¿ªÊ¼µÄÊÂÎñ¶¼Ôڴ˸ô
À뼶±ðÉÏÖ´ÐС£Ò»¸öÊÂÎñÖ»ÄܾßÓÐÒ»¸ö¸ôÀ뼶±ð¡£Í¬Ò»»á»°ÖеÄËùÓÐÊÂÎñ±ØÐë´®ÐÐÖ´ÐС£±ØÐëͨ¹ýbegin tranÓï¾äÀ´¸²¸ÇĬÈÏÊÂÎñ·¶Î§¡£
²âÊÔ£º
 /*»·¾³*/
CREATE TABLE [dbo].[TranTest](
 [Id] [int] IDENTITY(1,1) NOT NULL,
 [count1] [int] NULL,
 [count2] [int] NULL
)
insert into TranTest values(1,2)
insert into TranTest values(3,4)
insert into TranTest values(5,6)
insert into TranTest values(7,8)
Ô¼¶¨×ÜÊÇÏÈÖ´ÐÐsession1£¬²¢ÇÒÔÚsession1½áÊøÇ°Ö´ÐÐsession2
1. ÅÅËûËø×ÜÊÇÔÚÊÂÎñ½áÊøʱÊÍ·Å
--session 1
set tran isolation level any
begin tran
 update TranTest set count1=count1 + 10 where id=1
 waitfor delay '00:00:10'
commit tran
--session 2
 select * from TranTest
ÏÖÏó£ºsession2±»×èÈûÖ±µ½session1ÖеĻỰ½áÊø¡£
½âÊÍ£ºsession1Ê×ÏÈÖ´ÐУ¬¸üÐÂid=1µÄÐÐʱ³ÖÓÐÁ˸ÃÐеÄÅÅËûËø£¬¸ÃËøÖ±µ½session1ÖеÄÊÂÎñ½áÊøʱÊÍ·Å£¬Õâ×èÖ¹
ÁËsession2»ñµÃ¹²ÏíËø¡£
2. ¶ÁδÌá½»ÎÞÐèÈκÎËø
--session 1
set tran isolation level any
begin tran
 update TranTest set count1=count1 + 10 where id=1
 waitfor delay '00:00:10'
commit tran
--session 2
set tran isolation level read uncommitted
begin tran
 select * from TranTest
commit tran
ÏÖÏó£ºsession2δ±»×èÈû£¬¶øÊǶÁÈ¡µ½ÁËsession1ÉÐδÌá½»µÄÊý¾Ý¡£
½âÊÍ£º¶ÁδÌá½»ÎÞÐèËø¶¨£¬Òò¶øÈÆ¿ªÁËËø¶¨»úÖÆ¡£
3. ËÀËø
--session 1
set tran isolation level read committed
begin tr


Ïà¹ØÎĵµ£º

Sql Server Êý¾Ý¿âÁ¬½ÓÎÊÌâ

²Î¿¼ÎÄÏ×£ºhttp://www.cnblogs.com/chenxizhang/archive/2009/04/23/1441913.html
SQL ServerÌṩËÄÖÖ·½Ê½Á¬½ÓÊý¾Ý¿â·þÎñÆ÷:
1. share memory: Ö»ÊÊÓÃÓÚ¿Í»§¶ËºÍ·þÎñÆ÷¶ËÔÚͬһ̨»úÆ÷ÉÏ,²ÅÄܲÉÓõÄÁ¬½Ó
2. Named pipe:
ÔÚ¾ÖÓòÍø(LAN)ÄÚʵÏÖÁ¬½Ó,Ò»¸ö½ø³ÌʹÓÃÒ»²¿·ÖµÄÄÚ´æÀ´Ïò½ø³ÌµÄÁíÒ»¶Ë´«µÝÏûÏ¢,Ò»¸ö½ø³ÌµÄÊä³öÊÇÁíÍâ ......

SQL ServerÊÓͼÖг£見ÏÞÖÆÌõ¼þ

--> Title  : SQL ServerÊÓͼÖг£見ÏÞÖÆÌõ¼þ
--> Author : wufeng4552
--> Date   : 2010-03-01
(1): ÊÓͼÊý¾Ý¸ü¸ÄµÄ³£見ÏÞ¶¨
µ±Óû§¸üÐÂÊÓͼÖеÄÊý¾Ýʱ,Æäʵ¸ü¸ÄµÄÊÇÆä¶ÔÓ¦µÄÊý¾Ý±íµÄÊý¾Ý.ÎÞÂÛÊǶÔÊÓͼÖеÄÊý¾Ý½øÐиü¸Ä,»¹ÊÇÔÚÊÓͼÖвåÈë»òÕßɾ³ýÊý¾Ý,¶¼ÊÇÀàËƵĵÀÀí.µ«ÊÇ,² ......

PowerDesignerÉú³ÉSQL ERͼ ˵Ã÷Îĵµ

Ò»¡¢PowerDesignerÉú³ÉsqlÎÊÌâ
Éú³ÉsqlµÄ·½·¨ÊÇ Database -->Generate Database (Ctrl + G ) µ«ÊÇÌáʾ Could not load VBScript engine.
Check VBScript installation. Generation aborted due to errors detected during the verification of the model. ¼ì²éÁ˺þà ·¢ÏÖ½«check model È¥µô¾Í¿ÉÒÔÁË£¡ÆäÖУ¬ o ......

SQL Convert ʱ¼ä½ØÈ¡£¨×ª»¯£©Ñùʽ

ÄÚÈÝת×Ô£ºhttp://blog.csdn.net/lfzwenzhu/archive/2008/03/06/2153473.aspx
SELECT CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
SELECT CONVERT(varchar(100), GETDATE(), 1): 05/16/06
SELECT CONVERT(varchar(100), GETDATE(), 2): 06.05.16
SELECT CONVERT(varchar(100), GETDATE(), 3): 16/05/06
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ