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

SQL ServerÖ®·Ö²¼Ê½ÊÂÎñ

--> Title  : SQL ServerÖ®·Ö²¼Ê½ÊÂÎñ
--> Author : wufeng4552
--> Date   : 2009-11-11
SQL ServerÖ®·Ö²¼Ê½ÊÂÎñ
(Ò»)¸ÅÄî:
·Ö²¼Ê½ÊÂÎñÊÇÉæ¼°À´×ÔÁ½¸ö»ò¶à¸öÔ´µÄ×ÊÔ´µÄÊÂÎñ¡£Microsoft® SQL Server™ 2000Ö§³Ö·Ö²¼Ê½ÊÂÎñ£¬Ê¹Óû§µÃÒÔ´´½¨ÊÂÎñÀ´¸üжà¸öSQL ServerÊý¾Ý¿âºÍÆäËüÊý¾ÝÔ´¡£
·Ö²¼Ê½ÊÂÎñ°üÀ¨£º
·×ÊÔ´¹ÜÀíÆ÷
¿ØÖÆ·Ö²¼Ê½ÊÂÎñËùÉæ¼°µÄÿ¸ö×ÊÔ´µÄÈí¼þ³ÆΪ×ÊÔ´¹ÜÀíÆ÷¡£·Ö²¼Ê½ÊÂÎñÓɸ÷¸ö×ÊÔ´¹ÜÀíÆ÷Äڵı¾µØÊÂÎñ×é³É¡£Ã¿¸ö×ÊÔ´¹ÜÀíÆ÷±ØÐëÄܹ»Óë·Ö²¼Ê½ÊÂÎñÄÚµÄËùÓÐÆäËü×ÊÔ´¹ÜÀíÆ÷ÏàЭµ÷£¬ÒÔÌá½»»ò»Ø¹ö×Ô¼ºµÄ±¾µØÊÂÎñ¡£SQL Server ¿ÉÒÔ×÷Ϊ·Ö²¼Ê½ÊÂÎñÄÚµÄ×ÊÔ´¹ÜÀíÆ÷¹¤×÷£¬²¢×ñ´ÓÓÃÓÚ·Ö²¼Ê½ÊÂÎñ´¦ÀíµÄ X/Open XA ¹æ·¶¡£
·ÊÂÎñ¹ÜÀíÆ÷
Ìá½»»ò»Ø¹ö·Ö²¼Ê½ÊÂÎñÓɳÆΪÊÂÎñ¹ÜÀíÆ÷µÄÈí¼þ×é¼þ¿ØÖÆ¡£ÊÂÎñ¹ÜÀíÆ÷Óëÿ¸ö×ÊÔ´¹ÜÀíÆ÷ÏàЭµ÷£¬È·±£Ò»ÆðÌá½»»ò»Ø¹öËùÓÐ×é³É·Ö²¼Ê½ÊÂÎñµÄ±¾µØÊÂÎñ¡£Microsoft·Ö²¼Ê½ÊÂÎñ´¦ÀíЭµ÷Æ÷ (MS DTC) ·þÎñÈçÊÂÎñ¹ÜÀíÆ÷Ò»Ñù¹¤×÷¡£MS DTC ×ñ´ÓÓÃÓÚ·Ö²¼Ê½ÊÂÎñ´¦ÀíµÄ X/Open XA ¹æ·¶¡£
·Á½½×¶ÎÌá½» (2PC)
ÐèÒª½øÐÐÌØÊâµÄÌá½»´¦Àí£¬ÒÔ·ÀÖ¹ÔÚ¹ÜÀí¿çÔ½¶à¸ö×ÊÔ´¹ÜÀíÆ÷µÄÊÂÎñʱ³öÏÖÎÊÌâ¡£µ±Ë¢ÐÂÈÕÖ¾»º³åÇøʹÆä¿ÉÓÃʱ£¬Ìá½»´óÊÂÎñ¿ÉÄÜÐèÒªÏà¶Ô½Ï³¤µÄʱ¼ä¡£Ìá½»½ø³Ì±¾Éí»¹¿ÉÄÜÓöµ½´íÎó£¬ÐèҪǿÐлعö¡£Èç¹ûÊÂÎñ¹ÜÀíÆ÷Ö»ÊÇÇëÇóÿ¸ö×ÊÔ´¹ÜÀíÆ÷Ìá½»£¬Ôò¿ÉÄÜ´ÓһЩ×ÊÔ´¹ÜÀíÆ÷·µ»Ø³É¹¦×´Ì¬£¬È»ºó´Óij¸ö×ÊÔ´¹ÜÀíÆ÷µÃµ½´íÎóÐÅÏ¢¡£Õâ»áµ¼Ö³åÍ»£¬ÒòΪËùÓзֲ¼Ê½ÊÂÎñ¶¼Ó¦»Ø¹ö£¬¶ø²¿·ÖÊÂÎñÒÑÌá½»¡£Á½½×¶ÎÌύͨ¹ý½«Ìá½»·Ö³ÉÁ½Ïà¿ÉÒÔ½â¾ö´ËÎÊÌ⣺
·×¼±¸
ÊÂÎñ¹ÜÀíÆ÷¸øÿ¸ö×ÊÔ´¹ÜÀíÆ÷·¢ËÍÒ»¸ö×¼±¸Ìá½»µÄÇëÇó¡£È»ºó£¬Ã¿¸ö×ÊÔ´¹ÜÀíÆ÷Ö´ÐÐÍê³ÉÌá½»½ø³ÌËùÐèµÄËùÓдóÁ¿Õ¼ÓÃ×ÊÔ´µÄ²Ù×÷£¬ÈçË¢ÐÂËùÓÐÈÕÖ¾»º³åÇø¡£×ÊÔ´¹ÜÀíÆ÷Ö»±£Áôά»¤ÊÂÎñÍêÕûÐÔËùÐèµÄ×îÉÙµÄËø£¬È»ºó¸øÊÂÎñ¹ÜÀíÆ÷·µ»Ø³É¹¦×´Ì¬¡£
·Ìá½»
Èç¹ûËùÓÐ×ÊÔ´¹ÜÀí¶Ô·¢¸øËüÃǵÄ×¼±¸ÇëÇ󷵻سɹ¦×´Ì¬£¬ÊÂÎñ¹ÜÀíÆ÷½«¸øÿ¸ö×ÊÔ´¹ÜÀíÆ÷·¢ËÍÌá½»ÃüÁȻºó£¬Ã¿¸ö×ÊÔ´¹ÜÀíÆ÷¿ìËÙ½«ÊÂÎñ¼Ç¼ΪÒÑÍê³É£¬²¢ÊÍ·ÅÉϴοØÖƵÄ×ÊÔ´¡£Èç¹ûÓÐÈκÎ×ÊÔ´¹ÜÀíÆ÷¶Ô×¼±¸ÇëÇ󷵻شíÎóÐÅÏ¢£¬ÊÂÎñ¹ÜÀíÆ÷½«¸øÿ¸ö×ÊÔ´¹ÜÀíÆ÷·¢ËͻعöÃüÁî¡£
Óм¸ÖÖ·½·¨¿ÉÒÔʹӦÓóÌÐòÔÚ·Ö²¼Ê½ÊÂÎñÄÚ°üÀ¨ SQL Server 2000£º
·Èç¹ûÓ¦ÓóÌÐòÓб¾µØÊÂÎñ²¢ÇÒ·¢³ö·Ö²¼Ê½²éѯ£¬±¾µØÊÂÎñ½«Éý¼¶µ½·Ö²¼Ê½ÊÂÎñ¡£
··¢³ö BEGIN DISTRIBUTED TRANSACTION Ó


Ïà¹ØÎĵµ£º

SQL×Ö·û´®´¦Àíº¯Êý´óÈ«

SQL×Ö·û´®´¦Àíº¯Êý´óÈ«(ת)2008-04-01 17:21SQL×Ö·û´®´¦Àíº¯Êý´óÈ«(ת)select ×Ö¶Î1 from ±í1 where ×Ö¶Î1.IndexOf("ÔÆ")=1;
ÕâÌõÓï¾ä²»¶ÔµÄÔ­ÒòÊÇindexof£¨£©º¯Êý²»ÊÇsqlº¯Êý£¬¸Ä³Ésql¶ÔÓ¦µÄº¯Êý¾Í¿ÉÒÔÁË¡£
left£¨£©ÊÇsqlº¯Êý¡£
select ×Ö¶Î1 from ±í1 where charindex£¨'ÔÆ',×Ö¶Î1£©=1; ×Ö·û´®º¯Êý¶Ô¶þ½øÖÆÊý¾Ý¡¢×Ö·û´ ......

ÀûÓÃÕýÔò±í´ïʽʵÏֵļòµ¥µÄÕûÀíSQLÎı¾µÄС¹¤¾ß

ÏÂÔصØÖ·£º http://download.csdn.net/source/1805903
  private string ReArrange(string str)
{
string[] keywords = new string[] {"select","from","where","and","order\\s+by","or","into",
"update","set","delete","haveing" ......

SQLÓÅ»¯¹ý³ÌÖг£¼ûOracle HINTµÄÓ÷¨

 ÔÚSQLÓï¾äÓÅ»¯¹ý³ÌÖУ¬ÎÒÃǾ­³£»áÓõ½hint,ÏÖ×ܽáÒ»ÏÂÔÚSQLÓÅ»¯¹ý³ÌÖг£¼ûOracle HINTµÄÓ÷¨£º
1. /*+ALL_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ¡Ôñ»ùÓÚ¿ªÏúµÄÓÅ»¯·½·¨,²¢»ñµÃ×î¼ÑÍÌÍÂÁ¿,ʹ×ÊÔ´ÏûºÄ×îС»¯.
ÀýÈç:
SELECT /*+ALL+_ROWS*/ EMP_NO,EMP_NAM,DAT_IN from BSEMPMS WHERE EMP_NO='SCOTT';
2. /*+FIRST_ROWS*/
±í ......

½â¾ösql server¹ÒÆð

 ½â¾ö·½·¨...
¹ØÓÚSQL°²×°±»¹ÒÆðµÄÐÞ¸´´ó¼Ò¿ÉÄܶ¼Óöµ½¹ýµ±SQL±»É¾³ýºóÐèÒªÖØа²×°Ê±£¬½øÈë°²×°½çÃæ¾Í»á³öÏÖSQL´íÎóÌáʾ£º
´ÓÇ°µÄ°²×°³ÌÐò²Ù×÷ʹ°²×°³ÌÐò²Ù×÷¹ÒÆð£¬ÐèÒªÖØÐÂÆô¶¯¼ÆËã»ú
È»¶øÕâЩ¶¼Êǰ׷Ѿ¢£¬²»¹ÜÄãÖØÐÂÆô¶¯¶àÉÙ´ÎÒ²¶¼ÎÞ¼ÃÓÚÊ£¬ÏÂÃæÎҾͽ²½²ÔõÑùÄܹ»½â³ý°²×°»òÉý¼¶Ê±Îļþ±»¹ÒÆðµÄ²Ù×÷¡£
µã»÷ ¿ ......

¹ØÓÚSQLÓï¾äµÄ×Ô¶¯Éú³É

ÔÚÎÒÃǵÄÈÕ³£±à³ÌÖУ¬Êý¾Ý¿âµÄ³ÌÐò»ù±¾É϶¼ÒªÓëSQLÓï¾ä´ò½»µÀ£¬SQLÓï¾äµÄ±àд²»¿É±ÜÃâµÄ³ÉΪһ¸öÍ·Ì۵Ť×÷¡£ÇÒÒòΪSQLÓï¾äÊÇSTRINGÀàÐÍ£¬Òò´ËÔÚ±àÒë½×¶Î²é²»³ö´í£¬Ö»Óе½ÔËÐÐʱ²ÅÄÜ·¢ÏÖ´íÎó¡£
±¾ÎĵĽâ¾ö·½°¸£¬Í¨¹ý×Ô¶¯Éú³ÉSQLÓï¾ä£¬ÔÚÒ»¶¨³Ì¶ÈÉϽµµÍ³ö´íµÄ¸ÅÂÊ£¬´Ó¶øÌá¸ß±à³ÌЧÂÊ¡£     public int ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ