SQLÓÅ»¯ Ë÷Òý
(Ò»)ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¡¡¡¡Êµ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý)ºÍ·Ç¾Û¼¯Ë÷Òý(nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý)¡£ÏÂÃ棬ÎÒÃǾÙÀýÀ´ËµÃ÷һϾۼ¯Ë÷ÒýºÍ·Ç¾Û¼¯Ë÷ÒýµÄÇø±ð£º
¡¡¡¡Æäʵ£¬ÎÒÃǵĺºÓï×ÖµäµÄÕýÎı¾Éí¾ÍÊÇÒ»¸ö¾Û¼¯Ë÷Òý¡£±ÈÈ磬ÎÒÃÇÒª²é“°²”×Ö£¬¾Í»áºÜ×ÔÈ»µØ·¿ª×ÖµäµÄÇ°¼¸Ò³£¬ÒòΪ“°²”µÄÆ´ÒôÊÇ“an”£¬¶ø°´ÕÕÆ´ÒôÅÅÐòºº×ÖµÄ×ÖµäÊÇÒÔÓ¢ÎÄ×Öĸ“a”¿ªÍ·²¢ÒÔ“z”½áβµÄ£¬ÄÇô“°²”×Ö¾Í×ÔÈ»µØÅÅÔÚ×ÖµäµÄÇ°²¿¡£Èç¹ûÄú·ÍêÁËËùÓÐÒÔ“a”¿ªÍ·µÄ²¿·ÖÈÔÈ»ÕÒ²»µ½Õâ¸ö×Ö£¬ÄÇô¾Í˵Ã÷ÄúµÄ×ÖµäÖÐûÓÐÕâ¸ö×Ö;ͬÑùµÄ£¬Èç¹û²é“ÕÅ”×Ö£¬ÄÇÄúÒ²»á½«ÄúµÄ×ֵ䷵½×îºó²¿·Ö£¬ÒòΪ“ÕÅ”µÄÆ´ÒôÊÇ“zhang”¡£Ò²¾ÍÊÇ˵£¬×ÖµäµÄÕýÎIJ¿·Ö±¾Éí¾ÍÊÇÒ»¸öĿ¼£¬Äú²»ÐèÒªÔÙÈ¥²éÆäËûĿ¼À´ÕÒµ½ÄúÐèÒªÕÒµÄÄÚÈÝ¡£
¡¡¡¡ÎÒÃÇ°ÑÕâÖÖÕýÎÄÄÚÈݱ¾Éí¾ÍÊÇÒ»ÖÖ°´ÕÕÒ»¶¨¹æÔòÅÅÁеÄĿ¼³ÆΪ“¾Û¼¯Ë÷Òý”¡£
¡¡¡¡Èç¹ûÄúÈÏʶij¸ö×Ö£¬Äú¿ÉÒÔ¿ìËٵشÓ×ÔµäÖв鵽Õâ¸ö×Ö¡£µ«ÄúÒ²¿ÉÄÜ»áÓöµ½Äú²»ÈÏʶµÄ×Ö£¬²»ÖªµÀËüµÄ·¢Òô£¬Õâʱºò£¬Äú¾Í²»ÄÜ°´Õողŵķ½·¨ÕÒµ½ÄúÒª²éµÄ×Ö£¬¶øÐèҪȥ¸ù¾Ý“Æ«ÅÔ²¿Ê×”²éµ½ÄúÒªÕÒµÄ×Ö£¬È»ºó¸ù¾ÝÕâ¸ö×ÖºóµÄÒ³ÂëÖ±½Ó·µ½Ä³Ò³À´ÕÒµ½ÄúÒªÕÒµÄ×Ö¡£µ«Äú½áºÏ“²¿Ê×Ŀ¼”ºÍ“¼ì×ֱ픶ø²éµ½µÄ×ÖµÄÅÅÐò²¢²»ÊÇÕæÕýµÄÕýÎĵÄÅÅÐò·½·¨£¬±ÈÈçÄú²é“ÕÅ”×Ö£¬ÎÒÃÇ¿ÉÒÔ¿´µ½Ôڲ鲿Ê×Ö®ºóµÄ¼ì×Ö±íÖГÕÅ”µÄÒ³ÂëÊÇ672Ò³£¬¼ì×Ö±íÖГÕÅ”µÄÉÏÃæÊÇ“³Û”×Ö£¬µ«Ò³ÂëÈ´ÊÇ63Ò³£¬“ÕÅ”µÄÏÂÃæÊÇ“åó”×Ö£¬Ò³ÃæÊÇ390Ò³¡£ºÜÏÔÈ»£¬ÕâЩ×Ö²¢²»ÊÇÕæÕýµÄ·Ö±ðλÓÚ“ÕÅ”×ÖµÄÉÏÏ·½£¬ÏÖÔÚÄú¿´µ½µÄÁ¬ÐøµÄ“³Û¡¢ÕÅ¡¢åó”Èý×Öʵ¼ÊÉϾÍÊÇËûÃÇÔڷǾۼ¯Ë÷ÒýÖеÄÅÅÐò£¬ÊÇ×ÖµäÕýÎÄÖеÄ×ÖÔڷǾۼ¯Ë÷ÒýÖеÄÓ³Éä¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÕâÖÖ·½Ê½À´ÕÒµ½ÄúËùÐèÒªµÄ×Ö£¬µ«ËüÐèÒªÁ½¸ö¹ý³Ì£¬ÏÈÕÒµ½Ä¿Â¼ÖеĽá¹û£¬È»ºóÔÙ·µ½ÄúËùÐèÒªµÄÒ³Âë¡£
¡¡¡¡ÎÒÃÇ°ÑÕâÖÖĿ¼´¿´âÊÇĿ¼£¬ÕýÎÄ´¿´âÊÇÕýÎĵÄÅÅÐò·½Ê½³ÆΪ“·Ç¾Û¼¯Ë÷Òý”¡£
¡¡¡¡Í¨¹ýÒÔÉÏÀý×Ó£¬ÎÒÃÇ¿ÉÒÔÀí½âµ½Ê²Ã´ÊÇ“¾Û¼¯Ë÷Òý”ºÍ“·Ç¾Û¼¯Ë÷Òý”¡£
¡¡¡¡½øÒ»²½ÒýÉêһϣ¬ÎÒÃÇ¿ÉÒÔºÜÈÝÒ×
Ïà¹ØÎĵµ£º
SELECT LEFT(RTRIM('20080927p1058'),LEN('20080927p1058')-2)
SELECT SUBSTRING('20080927p1058',1,LEN('20080927p1058')-2)
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*whit ......
Ò»´ÎProjectÏîĿƽ̨(PWA)ÒâÍâÍ£»úÇÒÅäÖÃÊý¾Ý¿âSharePoint_Config µÄLDF±»ÒâÍâɾ³ý,Èç¹ûÖ±½Ó¸½¼ÓMDFÎļþÔòÎÞ·¨¸½¼Ó.
Ïȳ¢ÊÔsp_attach_single_file_db»Ö¸´,Ö´ÐÐÈçÏÂ:
sp_attach_single_file_db 'SharePoint_Config','D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\SharePoint_Config.mdf'
³öÏÖ´íÎóÌáʾ:
......
¹«¸æ£º±¾²©¿ÍΪ΢ÈíÔƼÆËãÖÐÎIJ©¿ÍµÄ¾µÏñ²©¿Í£¬²¢²»±£Ö¤Á´½Ó¿ÉÓÃÐÔ£¬ÎªÁ˱£Ö¤ÔĶÁÌåÑ飬Çë·ÃÎÊhttp://blogs.msdn.com/azchina¡£
SQL Azure vs. SQL Server
¸ÅÒª
SQL Azure Database ÊÇÒ»¸öÀ´×Ô΢ÈíµÄ£¬»ùÓÚÔƵĹØϵÐÍÊý¾Ý¿â·þÎñ¡£SQL Azure Ìṩ¹ØϵÐÍÊý¾Ý¿â¹¦ÄÜÀ´×÷Ϊ¹«Ó÷þÎñ¡£»ùÓÚÔƵÄÊý¾Ý¿â½â¾ö·½°¸ ......
SQL Server 2005
±¾Æª½éÉÜÈçºÎÁ´½Óµ½Sql Server 2005.
²ÉÓÃSQL ±¾µØ¿Í»§ ODBCÇý¶¯
²ÉÓÃSqlÉí·ÝÑéÖ¤
Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
ÄãÕýÔÚʹÓÃSQL Server 2005 Express£¿±ðÍü¼ÇÁË£¬ServernameµÄÓï·¨ÊÇServername\SQLEXPRESS£¬Äã¿ÉÒÔÓÃÄã°²× ......
-- ²é¿´µ±Ç°dbµÄµÇ½
select * from sys.sql_logins
-- ²é¿´ÐÔÄܼÇÊýÆ÷
SELECT * from sys.dm_os_performance_counters
-- Ö´ÐйýµÄÏß³ÌËùÓöµ½µÄËùÓеȴý(²»Êǵ±Ç°ÕýÔÚÔËÐеÄÏß³Ì, Ϊ×ÔÉÏ´ÎÖØÖÃͳ¼ÆÐÅÏ¢»òÆô¶¯·þÎñÆ÷ÒÔÀ´ÀÛ»ýµÄÊý¾Ý),¿É·ÖÎö¿¿Ç°µÄ¼¸¸öµÈ´ý½Ï¸ßµÄʼþ¡£
select * from sys.dm_os_wait_stats order by wa ......