SQLSERVER¾Û¼¯Ë÷ÒýÓë·Ç¾Û¼¯Ë÷Òý£¨×ª£©
΢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý)ºÍ·Ç¾Û¼¯Ë÷Òý(nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý)……
(Ò»)ÉîÈëdz³öÀí½âË÷Òý½á¹¹
ʵ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý)ºÍ·Ç¾Û¼¯Ë÷Òý(nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý)¡£ÏÂÃ棬ÎÒÃǾÙÀýÀ´ËµÃ÷һϾۼ¯Ë÷ÒýºÍ·Ç¾Û¼¯Ë÷ÒýµÄÇø±ð£º
Æäʵ£¬ÎÒÃǵĺºÓï×ÖµäµÄÕýÎı¾Éí¾ÍÊÇÒ»¸ö¾Û¼¯Ë÷Òý¡£±ÈÈ磬ÎÒÃÇÒª²é“°²”×Ö£¬¾Í»áºÜ×ÔÈ»µØ·¿ª×ÖµäµÄÇ°¼¸Ò³£¬ÒòΪ“°²”µÄÆ´ÒôÊÇ“an”£¬¶ø°´ÕÕÆ´Òô ÅÅÐòºº×ÖµÄ×ÖµäÊÇÒÔÓ¢ÎÄ×Öĸ“a”¿ªÍ·²¢ÒÔ“z”½áβµÄ£¬ÄÇô“°²”×Ö¾Í×ÔÈ»µØÅÅÔÚ×ÖµäµÄÇ°²¿¡£Èç¹ûÄú·ÍêÁËËùÓÐÒÔ“a”¿ªÍ·µÄ²¿·ÖÈÔÈ»ÕÒ²»µ½Õâ¸ö×Ö£¬ÄÇ Ã´¾Í˵Ã÷ÄúµÄ×ÖµäÖÐûÓÐÕâ¸ö×Ö;ͬÑùµÄ£¬Èç¹û²é“ÕÅ”×Ö£¬ÄÇÄúÒ²»á½«ÄúµÄ×ֵ䷵½×îºó²¿·Ö£¬ÒòΪ“ÕÅ”µÄÆ´ÒôÊÇ“zhang”¡£Ò²¾ÍÊÇ˵£¬×ÖµäµÄÕýÎIJ¿·Ö ±¾Éí¾ÍÊÇÒ»¸öĿ¼£¬Äú²»ÐèÒªÔÙÈ¥²éÆäËûĿ¼À´ÕÒµ½ÄúÐèÒªÕÒµÄÄÚÈÝ¡£
ÎÒÃÇ°ÑÕâÖÖÕýÎÄÄÚÈݱ¾Éí¾ÍÊÇÒ»ÖÖ°´ÕÕÒ»¶¨¹æÔòÅÅÁеÄĿ¼³ÆΪ“¾Û¼¯Ë÷Òý”¡£
Èç¹ûÄúÈÏʶij¸ö×Ö£¬Äú¿ÉÒÔ¿ìËٵشÓ×ÔµäÖв鵽Õâ¸ö×Ö¡£µ«ÄúÒ²¿ÉÄÜ»áÓöµ½Äú²»ÈÏʶµÄ×Ö£¬²»ÖªµÀËüµÄ·¢Òô£¬Õâʱºò£¬Äú¾Í²»ÄÜ°´Õողŵķ½·¨ÕÒµ½ÄúÒª²éµÄ ×Ö£¬¶øÐèҪȥ¸ù¾Ý“Æ«ÅÔ²¿Ê×”²éµ½ÄúÒªÕÒµÄ×Ö£¬È»ºó¸ù¾ÝÕâ¸ö×ÖºóµÄÒ³ÂëÖ±½Ó·µ½Ä³Ò³À´ÕÒµ½ÄúÒªÕÒµÄ×Ö¡£µ«Äú½áºÏ“²¿Ê×Ŀ¼”ºÍ“¼ì×ֱ픶ø²éµ½µÄ×ÖµÄÅÅÐò ²¢²»ÊÇÕæÕýµÄÕýÎĵÄÅÅÐò·½·¨£¬±ÈÈçÄú²é“ÕÅ”×Ö£¬ÎÒÃÇ¿ÉÒÔ¿´µ½Ôڲ鲿Ê×Ö®ºóµÄ¼ì×Ö±íÖГÕÅ”µÄÒ³ÂëÊÇ672Ò³£¬¼ì×Ö±íÖГÕÅ”µÄÉÏÃæÊÇ“³Û”×Ö£¬µ«Ò³ÂëÈ´ ÊÇ63Ò³£¬“ÕÅ”µÄÏÂÃæÊÇ“åó”×Ö£¬Ò³ÃæÊÇ390Ò³¡£ºÜÏÔÈ»£¬ÕâЩ×Ö²¢²»ÊÇÕæÕýµÄ·Ö±ðλÓÚ“ÕÅ”×ÖµÄÉÏÏ·½£¬ÏÖÔÚÄú¿´µ½µÄÁ¬ÐøµÄ“³Û¡¢ÕÅ¡¢åó”Èý×Öʵ¼ÊÉÏ ¾ÍÊÇËûÃÇÔڷǾۼ¯Ë÷ÒýÖеÄÅÅÐò£¬ÊÇ×ÖµäÕýÎÄÖеÄ×ÖÔڷǾۼ¯Ë÷ÒýÖеÄÓ³Éä¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÕâÖÖ·½Ê½À´ÕÒµ½ÄúËùÐèÒªµÄ×Ö£¬µ«ËüÐèÒªÁ½¸ö¹ý³Ì£¬ÏÈÕÒµ½Ä¿Â¼ÖÐµÄ½á ¹û£¬È»ºóÔÙ·µ½ÄúËùÐèÒªµÄÒ³Âë¡£
ÎÒÃÇ°ÑÕâÖÖĿ¼´¿´âÊÇĿ¼£¬ÕýÎÄ´¿´âÊÇÕýÎĵÄÅÅÐò·½Ê½³ÆΪ&ldqu
Ïà¹ØÎĵµ£º
ÔÚдSQLʱ£¬ÓÐʱҪ¸ù¾ÝÒÑÓеÄÁÐÖµ¹¹ÔìеÄÁÐÖµ£¬Õâʱ¾ÍÒªÓõ½µÄSQLÖеÄcase¹Ø¼ü×Ö¡£ÈçÏÂËùʾ²éѯ¸ºÔðÈËÐÅÏ¢±í£¨T_MS_CustomerCrmInfoDutyPerson£©ÖеÄÊÇ·ñÊÇÖ÷Òª¸ºÔðÈË£¨isMainDuty£©×ֶΣ¬µ«ÊÇÕâ¸ö×ֶεÄÖµÊÇÒÔö¾ÙµÄ·½Ê½´æ´¢µÄ£¬´æ´¢0±íʾÊÇ·ñ£¬1±íʾÊÇ£¬·ñÔò±íʾδÅжϡ£Õâʱֱ½Ó²éѯ³öµÄÖµ²»ÊÇ ......
·ÖÁ½ÖÖÇé¿ö£º
1¡¢Í¨¹ý½Å±¾·½Ê½£¬2¡¢µ¼Èëµ¼³ö·½Ê½
µ«²»Í¬°æ±¾µÄSqlServer,ÔÚÕâ·½Ãæ²¢²»Ïàͬ¡£
sql2000¶ÔÊý¾Ý¿â¶ÔÏóÖ´ÐÐÉú³É½Å±¾Ê±£¬¾¡¹Ü¶¼Ñ¡Éϸ÷¸öÌõ¼þ£¬µ«¶ÔÓÚ±í¶ÔÏó²¢²»ÄÜ´´½¨Ö÷¼ü
¿ÉÒÔͨ¹ýµ¼Èëµ¼³ö·½Ê½£¬ÔÚµ¼ÈëÄ¿±êÑ¡ÔñÄ¿±êsqlserverºó£¬Ñ¡ÔñÖ»µ¼³ö¶ÔÏó½á¹¹¾ÍºÃÁË¡£
sql2005¶ÔÊý¾Ý¿â¶ÔÏóÖ´ÐÐÉú³É½Å±¾Ê±£¬¿ÉÒÔ´´½¨Ö÷¼ ......
sqlserver£ºupdate Table_A set Table_A.col1 = (select Table_B.col1 from Table_B where Table_A.col2 = Table_B.col2)
Access: UPDATE Table_ A, Table_B SET Table_ A.×Ö¶Î2 = Table_ B.×Ö¶Î2
WHERE Table_ A.񅧏=Table_ A.񅧏;
×Ô¼º¼ÇÏ£¬ÌáÐÑ×Ô¼º ......
Oracle´æ´¢¹ý³Ìת³ÉSqlserver´æ´¢¹ý³Ì
1.ÈÕÆÚת»»
Oracle£º TO_NUMBER(TO_CHAR(SYSDATE, 'YYYYMMDD'))
SqlServer£ºCAST(CONVERT(CHAR(8),GETDATE(), 112) AS INT)
×¢£ºÆäÖБYYYYMMDD’¸ñʽ ¶ÔÓ¦112
2.ROWIDת»»
Oracle£º ROWID
SqlServer: PRIMARY KEY(±íÖ÷¼ü)
3.ROWNUM ......
1.°²×°ºÃSQLServer 2005Êý¾Ý¿âÈí¼þ£¬½Ó×Å×îÖØÒªµÄ¾ÍÊÇ°²×°Êý¾Ý¿âÇý¶¯SQL Server 2005 driver for JDBC£¬¿ÉÒÔµ½:http://download.microsoft.com/download/8/B/D/8BDABAE2-B6EA-41D4-B903-7916EF3690EF/sqljdbc_1.2.2323.101_enu.exeÏÂÔØ
2.½«JDBC½âѹµ½ÈÎÒâµÄλÖã¬ÔÚ°²×°Ä¿Â¼ÀïÕÒµ½sqljdbc.jarÎļþ£¬ÒÔÇ°µÄÎÄÕÂÖÐÒѾ½²¹ý» ......