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

sqlserver ÐÔÄÜÓÅ»¯£­£­Join˵Ã÷

ÓÉÓÚ¹¤×÷ÐèÇó£¬Òª¶Ô¸ºÔðµÄ²ú Æ·×öµãÐÔÄÜÓÅ»¯£¬ÔÚÍøÉÏÕÒµ½ÁËÏà¹ØµÄ¶«Î÷£¬Äà ³öÀ´Óë´ó¼Ò·ÖÏí£º
¿´µ½ºÜ¶àÅóÓѶÔÊý¾Ý¿âµÄÀí½â¡¢ÈÏʶ»¹ÊÇûÓÐÍ»ÆÆÒ»¸öÆ¿¾±£¬¶øÕâ¸öÆ¿¾±ÍùÍùÖ»ÊÇÒ»²ã´°Ö½£¬Ô½¹ýÁËÄ㽫¿´µ½Ò»¸öÐÂÊÀ½ç¡£
04¡¢05Äê×öÏîÄ¿µÄʱºò£¬ÓÃSQL Server 2000£¬ºËÐÄ±í£¨´ó²¿·ÖʹÓÃƵ·±µÄ¹Ø¼ü¹¦ÄÜÿ´Î¶¼ÒªÓõ½£©´ïµ½ÁË800ÍòÊý¾ÝÁ¿£¬ºÜÔçÒÔÇ°²é¹ýһЩÏà¹Ø±í£¬ÓеĴﵽÁË3000¶àÍò£¬´ÅÅÌʹÓõĹâÏËÅÌ£¬100G¿Õ¼ä£¬Ã¿ÖܱØÐ뱸·ÝתÒÆÊý¾Ý£¬·ñÔò100G¿Õ¼äÒ»ÖÜ»áÂúµô£¬Õâ¸öϵͳ¼¸ÄêÀ´£¬Ä¿Ç°ÈÔÈ»±£³Ö·Ç³£Á¼ºÃµÄÐÔÄÜ¡£»¹Ìý˵¹ýÅóÓѵÄSQL Server 2000Êý¾Ý¿â¹¤×÷ÔÚ¼¸Ê®TBµÄ»·¾³Ï£¬¸ß²¢·¢Á¿£¬¶ÔÕâÖÖ¼¶±ðµÄ¼ÝÔ¦ÄÜÁ¦ÎÒ»¹ÊDzîµÄºÜÒ£Ô¶¡£
Ïëµ±Ä꣬ҲÊÇÒ»ÌáSQL Server£¬¾Í¾õµÃËüµÄÐÔÄÜû·¨¸úOracleÏà±È£¬Ò»Ìáµ½´óÊý¾Ý´¦Àí¾ÍÏëµ½Oracle¡£×Ô¼ºÒ»Â·×ßÀ´£¬ÔÚ±¾µØblogÉϼǼÁ˺ܶàÓÅ»¯·½ÃæµÄpost£¬¶ÔµÄ´íµÄ¶¼ÓУ¬Ã»ÓÐʱ¼äϵÁеÄÕûÀí³öÀ´£¬ÕâƪÎÄÕ½«join·½·¨µÄ¸ÅÄîÉÔ΢ÕûÀíÔÚÒ»Æ𣬸ø´ó¼Ò¸ö²Î¿¼¡£Í¨¹ý²é×ÊÁÏÁ˽âÀïÃæÌáµ½µÄ¸÷ÖÖ¸ÅÄÔÚʵ¼ÊÖ⻶ÏÑéÖ¤×ܽᣬÍêÈ«¿ÉÒÔ¶ÔÊý¾Ý¿âÒ»²½²½ÉîÈëÀí½âÏÂÈ¥µÄ¡£
ÎÒÖ»¶ÔSQL Server 2000±È½ÏÁ˽⣬µ«Õâ²¢²»×è°­ÎÒÔÚOracle¡¢MySql½øÐÐSQLµ÷ÓÅ¡¢²úÆ·¼Ü¹¹£¬ÒòΪÔÚÊý¾Ý¿âÀíÂÛÔ­ÀíÉÏ£¬¸÷´óÊý¾Ý¿â»ù±¾³öÈë²»´ó£¬¶ÔÊý¾Ý¿âµÄÉîÈëÀí½â£¬Ò²²»»áÓ°ÏìÄã¼Ü¹¹Éè¼Æ˼Ïë±ä»µ£¬Ïà·´¸øÄã´øÀ´µÄÊǸüÉî²ã´ÎµÄ˼¿¼¡£
¹ØÓÚÖ´Ðмƻ®µÄ˵Ã÷
ÔÚSQL Server²éѯ·ÖÎöÆ÷µÄQuery²Ëµ¥ÖÐÑ¡ÔñShow Execution Plan£¬ÔËÐÐSQL²éѯÓï¾ä£¬ÔÚ½á¹û´°¿ÚÖÐÓÐGrid¡¢Execution Plan¡¢MessagesÈý¸öTab¡£¿´Í¼ÐÎÐÎʽµÄÖ´Ðмƻ®£¬Ë³ÐòÊÇ´ÓÓÒµ½×ó£¬ÕâÒ²ÊÇÖ´ÐеÄ˳Ðò¡£Ö´Ðмƻ®ÖеÄÿһ¸öͼ±ê±íʾһ¸ö²Ù×÷£¬Ã¿Ò»¸ö²Ù×÷¶¼»áÓÐÒ»¸ö»ò¶à¸öÊäÈ룬Ҳ»áÓÐÒ»¸ö»ò¶à¸öÊä³ö¡£ÊäÈëºÍÊä³ö£¬ÓпÉÄÜÊÇÒ»¸öÎïÀíÊý¾Ý±í¡¢Ë÷ÒýÊý¾Ý½á¹¹£¬»òÕßÊÇÖ´Ðйý³ÌÖеÄһЩÖмä½á¹û¼¯/Êý¾Ý½á¹¹¡£Êó±êÒƶ¯µ½Í¼±êÉÏ£¬»áÏÔʾÕâ¸ö²Ù×÷µÄ¾ßÌåÐÅÏ¢£¬ÀýÈçÂß¼­ºÍÎïÀí²Ù×÷Ãû³Æ¡¢¼Ç¼µÄÊýÁ¿ºÍ´óС¡¢I/O³É±¾¡¢CPU³É±¾¡¢²Ù×÷µÄ¾ßÌå±í´ïʽ£¨²ÎÊýArgument£©¡£Êó±êÒƶ¯µ½Á¬½Ó¼ýÍ·ÉÏ£¬»áÏÔʾ¼ýÍ·Æðʼ¶ËµÄ²Ù×÷Êä³ö½á¹û¼¯µÄ¼Ç¼Êý¡¢¼Ç¼µÄ´óС£¬Ò»°ãÇé¿öÏ¿ÉÒÔ½«Õâ¸öÊä³ö½á¹û¼¯Àí½âΪ¼ýÍ·½áÊø¶ËµÄÊäÈë¡£
ÁíÍâ¹ØÓÚÖ´Ðмƻ®µÄһЩ²¹³ä˵Ã÷£º1. Ö´Ðмƻ®ÖÐÏÔʾµÄÐÅÏ¢£¬¶¼ÊÇÒ»¸ö“ÆÀ¹À”µÄ½á¹û£¬²»ÊÇ100%׼ȷµÄÐÅÏ¢£¬ÀýÈç¼Ç¼ÊýÁ¿ÊÇÈ¡×Ôͳ¼ÆÐÅÏ¢£¬I/O³É±¾¡¢CPU³É±¾À´×ÔÖ´Ðмƻ®Éú³É¹ý³ÌÖлùÓÚͳ¼ÆÐÅÏ¢µÈµÃ³öµÄÆÀ¹À½á¹û¡£2. Ö´Ðмƻ®²»Ò»¶


Ïà¹ØÎĵµ£º

MyEclipseÖÐÅäÖÃSQLServer 2005Êý¾Ý¿â

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Îļþ£¬ÒÔÇ°µÄÎÄÕÂÖÐÒѾ­½²¹ý» ......

SQLSERVERÓû§È¨ÏÞ¹ÜÀíÊý¾Ý¿â

Óû§È¨ÏÞ¹ÜÀí
Ò»¡¢·þÎñÆ÷µÇ¼ÕʺźÍÓû§ÕʺŹÜÀí
1.SQL Server·þÎñÆ÷µÇ¼¹ÜÀí
²»¹ÜʹÓÃÄÄÖÖÈÏ֤ģʽ£¬Óû§¶¼±ØÐëÏȾ߱¸ÓÐЧµÄÓû§µÇ¼Õʺš£SQL ServerÓÐÈý¸öĬÈϵÄÓû§µÇ¼Õʺţº¼´sa¡¢Builtin\administratorsºÍguest¡£saÊÇϵͳ¹ÜÀíÔ±(system administrator)µÄ¼ò³Æ£¬ÊÇÒ»¸öÌØÊâµÄÓû§£¬ÔÚSQL ServerϵͳºÍËùÓÐÊý¾Ý¿âÖÐÓ ......

SQLServerÖÐÎÄ´¦Àí

Ê×ÏȲå¾äÌâÍâ»°£º´´½¨Ò»¸ö×ÔÈ»Êý±íNums¡£ÕâÊÇ¡¶SQL Server 2005¼¼ÊõÄÚÄ»£ºT-SQL²éѯ¡·Ò»ÊéµÄ½¨Òé¡£
ÔÚSQL Server 2005ÖУ¬¿ÉÒÔ½èÓÃROW_NUMBERÅÅÃûº¯ÊýÇáËÉÉú³ÉÎÒÃÇËùÐèµÄ×ÔÈ»Êý±í£º
--×ÔÈ»Êý±í1-1M
CREATE TABLE Nums(n int NOT NULL PRIMARY KEY CLUSTERED)
WITH B1 AS(SELECT n=1 UNION ALL SELECT n=1), --2
B2 AS( ......

SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ

SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ
2008-01-23 15:47
SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ2008-01-15 15:51SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ
SQL ServerÖÐÎÄ°æµÄĬÈϵÄÈÕÆÚ×Ö¶Îdatetime¸ñʽÊÇyyyy-mm-dd Thh:mm:ss.mmm
ÀýÈç:
select getdate()
2004-09-12 11:06:08.177
ÕûÀíÁËÒ»ÏÂSQL ServerÀïÃæ¿ÉÄÜ ......

SQLserverʱ¼ä¶Î²éѯ

eg:
select * from Exception_Log where DATEDIFF(day,OPER_DATE,getdate())<30 ;
/*
oper_date Ϊ±íÖвéѯ³öÀ´µÄʱ¼ä
getdate()ΪSQLServerÀïÃæ»ñµÃϵͳʱ¼äµÄº¯Êý
º¬Ò壺µ±Ç°Ê±¼ä-²éѯ³öÀ´µÄʱ¼äСÓÚ30Ìì
DateDiff¾ßÌåÓ÷¨£º
*/
DateDiff º¯Êý
·µ»ØÁ½¸öÈÕÆÚÖ®¼äµÄʱ¼ä¼ä¸ô¡£
DateDiff(interval, date1, da ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ