SQL ServerÖС°¼ÓËøÑ¡ÏµÄ¹¦ÄÜ˵Ã÷
1 ÈçºÎËøÒ»¸ö±íµÄijһÐÐ
A Á¬½ÓÖÐÖ´ÐÐ
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ
begin tran
select * from tablename with (rowlock) where id=3
waitfor delay '00:00:05'
commit tran
BÁ¬½ÓÖÐÈç¹ûÖ´ÐÐ
update tablename set colname='10' where id=3 --ÔòÒªµÈ´ý5Ãë
update tablename set colname='10' where id<>3 --¿ÉÁ¢¼´Ö´ÐÐ
2 Ëø¶¨Êý¾Ý¿âµÄÒ»¸ö±í
SELECT * from table WITH (HOLDLOCK)
×¢Òâ: Ëø¶¨Êý¾Ý¿âµÄÒ»¸ö±íµÄÇø±ð
SELECT * from table WITH (HOLDLOCK)
ÆäËûÊÂÎñ¿ÉÒÔ¶ÁÈ¡±í£¬µ«²»ÄܸüÐÂɾ³ý
SELECT * from table WITH (TABLOCKX)
ÆäËûÊÂÎñ²»ÄܶÁÈ¡±í,¸üкÍɾ³ý
SELECT Óï¾äÖГ¼ÓËøÑ¡ÏŦÄÜ˵Ã÷
SQL ServerÌṩÁËÇ¿´ó¶øÍ걸µÄËø»úÖÆÀ´°ïÖúʵÏÖÊý¾Ý¿âϵͳµÄ²¢·¢ÐԺ͸ßÐÔÄÜ¡£Óû§¼ÈÄÜʹÓÃSQL ServerµÄȱʡÉèÖÃÒ²¿ÉÒÔÔÚselect Óï¾äÖÐʹÓÓ¼ÓËøÑ¡Ïî”À´ÊµÏÖÔ¤ÆÚµÄЧ¹û¡£ ±¾ÎĽéÉÜÁËSELECTÓï¾äÖеĸ÷ÏÓËøÑ¡Ïî”ÒÔ¼°ÏàÓ¦µÄ¹¦ÄÜ˵Ã÷¡£
¹¦ÄÜ˵Ã÷£º¡¡
NOLOCK£¨²»¼ÓËø£©
´ËÑ¡ÏѡÖÐʱ£¬SQL Server ÔÚ¶ÁÈ¡»òÐÞ¸ÄÊý¾Ý
Ïà¹ØÎĵµ£º
SQL ½Ì³Ì
1£©SQL ¼ò½é
SQL(Structured Query Language£¬½á¹¹²éѯÓïÑÔ)ÊÇÒ»¸ö¹¦ÄÜÇ¿´óµÄÊý¾Ý¿âÓïÑÔ¡£SQLͨ³£Ê¹ÓÃÓÚÊý¾Ý¿âµÄͨѶ¡£ANSI£¨ÃÀ¹ú¹ú¼Ò±ê׼ѧ»á£©Éù³Æ£¬SQLÊǹØÏµÊý¾Ý¿â¹ÜÀíϵͳµÄ±ê×¼ÓïÑÔ¡£SQLÓï¾äͨ³£ÓÃÓÚÍê³ÉһЩÊý¾Ý¿âµÄ²Ù×÷ÈÎÎñ£¬±ÈÈçÔÚÊý¾Ý¿âÖиüÐÂÊý¾Ý£¬»òÕß´ÓÊý¾Ý¿âÖмìË÷Êý¾Ý¡£Ê¹ÓÃSQLµÄ³£¼û¹ØÏµÊý¾Ý¿â¹ ......
ºØÖÝÊм²²¡Ô¤·À¿ØÖÆÖÐÐÄËùÓõÄZmSoft´ÓÒµÌå¼ìÐÅÏ¢ÍøÂçϵͳV2010.1.26 Õýʽ°æ²ÉÓÃSQL SERVER2000ƽ̨,²»Ã÷ÔÒò,Êý¾Ý¿â"ÖÃÒÉ“,¿Í»§ÊÔ¹ýËùÓÐÍøÉÏ·½·¨,δÄܽâ¾ö.ÉòÑô¿ÎÄÊý¾Ý»Ö¸´ÖÐÐÄSQLÊý¾Ý¿â¹¤³Ìʦ³É¹¦½«Æä½â¾ö.
ÉòÑô¿ÎÄÊý¾Ý»Ö¸´ÖÐÐÄMS SQL SERVERÑз¢Ð¡×éÖÂÁ¦ÓÚMsSqlÊý¾Ý¿â¼¼ÊõµÄÑо¿¡£¾¹ý¶àÄêÑо¿ÍêÈ«ÕÆÎÕÁËS ......
ÎÒÃÇÒª×öµ½²»µ«»áдSQL,»¹Òª×öµ½Ð´³öÐÔÄÜÓÅÁ¼µÄSQL,ÒÔÏÂΪ±ÊÕßѧϰ¡¢ÕªÂ¼¡¢²¢»ã×ܲ¿·Ö×ÊÁÏÓë´ó¼Ò·ÖÏí£¡
£¨1£© Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
ORACLE µÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom× ......
ÍøÂç±ðÃû
-----------------------------------------------------------------------------
ÓÃ;£ºÎªÔ¶³Ì·þÎñÆ÷µÄÒÑÓбíÌí¼ÓÊý¾Ý
-----------------------------------------------------------------------------
²½Ö裺
SQL Server2000/2005
1. ÔËÐпͻ§¶ËÍøÂçʵÓù¤¾ß£¨
£¨1£© SQL Server2000-Client Network Ut ......
1:replace º¯Êý
µÚÒ»¸ö²ÎÊýÄãµÄ×Ö·û´®£¬µÚ¶þ¸ö²ÎÊýÄãÏëÌæ»»µÄ²¿·Ö£¬µÚÈý¸ö²ÎÊýÄãÒªÌæ»»³Éʲô
select replace('lihan','a','b')
&nb ......