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

SQL ÓαêÔ­ÀíºÍʹÓ÷½·¨

 Êý¾Ý¿â¿ª·¢¹ý³ÌÖУ¬µ±Äã¼ìË÷µÄÊý¾ÝÖ»ÊÇÒ»Ìõ¼Ç¼ʱ£¬ÄãËù±àдµÄÊÂÎñÓï¾ä´úÂëÍùÍùʹÓÃSELECT INSERT Óï¾ä¡£µ«ÊÇÎÒÃdz£³£»áÓöµ½ÕâÑùÇé¿ö£¬¼´´Óijһ½á¹û¼¯ÖÐÖðÒ»µØ¶ÁÈ¡Ò»Ìõ¼Ç¼¡£ÄÇôÈçºÎ½â¾öÕâÖÖÎÊÌâÄØ£¿ÓαêΪÎÒÃÇÌṩÁËÒ»ÖÖ¼«ÎªÓÅÐãµÄ½â¾ö·½°¸¡£
      1.1 ÓαêºÍÓαêµÄÓŵã
       ÔÚÊý¾Ý¿âÖУ¬ÓαêÊÇÒ»¸öÊ®·ÖÖØÒªµÄ¸ÅÄî¡£ÓαêÌṩÁËÒ»ÖÖ¶Ô´Ó±íÖмìË÷³öµÄÊý¾Ý½øÐвÙ×÷µÄÁé»îÊֶΣ¬¾Í±¾ÖʶøÑÔ£¬Óαêʵ¼ÊÉÏÊÇÒ»ÖÖÄÜ´Ó°üÀ¨¶àÌõÊý¾Ý¼Ç¼µÄ½á¹û¼¯ÖÐÿ´ÎÌáÈ¡Ò»Ìõ¼Ç¼µÄ»úÖÆ¡£Óαê×ÜÊÇÓëÒ»ÌõT_SQL Ñ¡ÔñÓï¾äÏà¹ØÁªÒòΪÓαêÓɽá¹û¼¯£¨¿ÉÒÔÊÇÁãÌõ¡¢Ò»Ìõ»òÓÉÏà¹ØµÄÑ¡ÔñÓï¾ä¼ìË÷³öµÄ¶àÌõ¼Ç¼£©ºÍ½á¹û¼¯ÖÐÖ¸ÏòÌض¨¼Ç¼µÄÓαêλÖÃ×é³É¡£µ±¾ö¶¨¶Ô½á¹û¼¯½øÐд¦Àíʱ£¬±ØÐëÉùÃ÷Ò»¸öÖ¸Ïò¸Ã½á¹û¼¯µÄÓαꡣ
     ÎÒÃÇÖªµÀ¹ØϵÊý¾Ý¿â¹ÜÀíϵͳʵÖÊÊÇÃæÏò¼¯ºÏµÄ£¬ÔÚMS SQL SERVER Öв¢Ã»ÓÐÒ»ÖÖÃèÊö±íÖе¥Ò»¼Ç¼µÄ±í´ïÐÎʽ£¬³ý·ÇʹÓÃwhere ×Ó¾äÀ´ÏÞÖÆÖ»ÓÐÒ»Ìõ¼Ç¼±»Ñ¡ÖС£Òò´ËÎÒÃDZØÐë½èÖúÓÚÓαêÀ´½øÐÐÃæÏòµ¥Ìõ¼Ç¼µÄÊý¾Ý´¦Àí¡£
     Óɴ˿ɼû£¬ÓαêÔÊÐíÓ¦ÓóÌÐò¶Ô²éѯÓï¾äselect ·µ»ØµÄÐнá¹û¼¯ÖÐÿһÐнøÐÐÏàͬ»ò²»Í¬µÄ²Ù×÷£¬¶ø²»ÊÇÒ»´Î¶ÔÕû¸ö½á¹û¼¯½øÐÐͬһÖÖ²Ù×÷£»Ëü»¹Ìṩ¶Ô»ùÓÚÓαêλÖöø¶Ô±íÖÐÊý¾Ý½øÐÐɾ³ý»ò¸üеÄÄÜÁ¦£»¶øÇÒ£¬ÕýÊÇÓαê°Ñ×÷ΪÃæÏò¼¯ºÏµÄÊý¾Ý¿â¹ÜÀíϵͳºÍÃæÏòÐеijÌÐòÉè¼ÆÁ½ÕßÁªÏµÆðÀ´£¬Ê¹Á½¸öÊý¾Ý´¦Àí·½Ê½Äܹ»½øÐйµÍ¨¡£
     1.2 ÓαêÖÖÀà
MS SQL SERVER Ö§³ÖÈýÖÖÀàÐ͵ÄÓα꣺Transact_SQL Óα꣬API ·þÎñÆ÷ÓαêºÍ¿Í»§Óαꡣ
£¨1£© Transact_SQL Óαê
    Transact_SQL ÓαêÊÇÓÉDECLARE CURSOR Óï·¨¶¨Òå¡¢Ö÷ÒªÓÃÔÚTransact_SQL ½Å±¾¡¢´æ´¢¹ý³ÌºÍ´¥·¢Æ÷ÖС£Transact_SQL ÓαêÖ÷ÒªÓÃÔÚ·þÎñÆ÷ÉÏ£¬ÓÉ´Ó¿Í»§¶Ë·¢Ë͸ø·þÎñÆ÷µÄTransact_SQL Óï¾ä»òÊÇÅú´¦Àí¡¢´æ´¢¹ý³Ì¡¢´¥·¢Æ÷ÖеÄTransact_SQL ½øÐйÜÀí¡£ Transact_SQL Óα겻֧³ÖÌáÈ¡Êý¾Ý¿é»ò¶àÐÐÊý¾Ý¡£
£¨2£© API Óαê
    API ÓαêÖ§³ÖÔÚOLE DB£¬ ODBC ÒÔ¼°DB_library ÖÐʹÓÃÓα꺯Êý£¬Ö÷ÒªÓÃÔÚ·þÎñÆ÷ÉÏ¡£Ã¿Ò»´Î¿Í»§¶ËÓ¦ÓóÌÐòµ÷ÓÃAPI Óα꺯Êý£¬MS SQL SEVER µÄOLE DB ÌṩÕß¡¢ODBCÇý¶¯Æ÷»òDB_library µÄ¶¯Ì¬Á´½Ó¿â£¨DLL£© ¶¼»á½«ÕâЩ¿Í»§ÇëÇó´«Ë͸ø·þÎñÆ÷ÒÔ¶ÔAPIÓαê½øÐд¦Àí¡£
£¨3£© ¿Í»§Óαê
    ¿Í»§ÓÎ


Ïà¹ØÎĵµ£º

SQL ×Ö·û´®½ØȡʾÀý

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 ......

SQL SERVER 2005 Ö»ÓÐmdfÎļþµÄÊý¾Ý»Ö¸´·½·¨


Ò»´Î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'
³öÏÖ´íÎóÌáʾ:
......

SQL Server 2005/2008¹ÜÀí£¨´ýÐø£©

-- ²é¿´µ±Ç°dbµÄµÇ½
select * from sys.sql_logins
-- ²é¿´ÐÔÄܼÇÊýÆ÷
SELECT * from sys.dm_os_performance_counters
-- Ö´ÐйýµÄÏß³ÌËùÓöµ½µÄËùÓеȴý(²»Êǵ±Ç°ÕýÔÚÔËÐеÄÏß³Ì, Ϊ×ÔÉÏ´ÎÖØÖÃͳ¼ÆÐÅÏ¢»òÆô¶¯·þÎñÆ÷ÒÔÀ´ÀÛ»ýµÄÊý¾Ý),¿É·ÖÎö¿¿Ç°µÄ¼¸¸öµÈ´ý½Ï¸ßµÄʼþ¡£
select * from sys.dm_os_wait_stats order by wa ......

SQLÓÅ»¯ Ë÷Òý

(Ò»)ÉîÈëdz³öÀí½âË÷Òý½á¹¹
¡¡¡¡Êµ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý)ºÍ·Ç¾Û¼¯Ë÷Òý(nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý)¡£ÏÂÃ棬ÎÒÃǾÙÀýÀ´ËµÃ÷һϾۼ¯Ë÷ÒýºÍ·Ç¾Û¼¯Ë÷ÒýµÄÇø±ð£º
¡¡¡¡Æäʵ£¬ÎÒÃǵĺºÓï×ÖµäµÄÕýÎı ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ