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

SQl 2005 For XMl ¼òµ¥²éѯ(Raw£¬Auto£¬Pathģʽ)(1)

 ºÜ¶àÈ˶ÔXpath¿ÉÄܱȽÏÊìϤ£¬µ«²»ÖªµÀÓÐûÓÐÖ±½Ó²Ù×÷¹ýÊý¾Ý¿â£¬ÎÒÃǶ¼ÖªµÀ ÔÚSql2005À﹫֧³ÖµÄ¼¸ÖÖ²éѯÓÐRaw£¬Auto£¬PathģʽµÈ£¬Èç¹ûÔÚ2000ÀïʹÓùý PathģʽµÄÅóÓÑÓ¦¸ÃÖªµÀ£¬ÊDz»ÈÝÒ×´¦Àí²éѯ½á¹ûµÄ£¬ÄÇôÔÚ2005Àï¶ÔÕâÒ»¿é×öÁ˺ܺõÄÌáÉý
        ÎÒÏÈÀ´½éÉÜÒ»ÏÂʲôÊÇSql¡¡For¡¡Xml°É£¬ÎÒÃÇ´ó¶àʱºò¶¼»áÓÐÕâÖÖÇé¿ö£¬Ïë°Ñ±íÀïµÄÊý¾Ýת»¯³ÉXml¸ñʽµÄ£¬Í¨³£ÎÒÃÇ»áʹÓÃc#»òÊÇVb³ÌÐòÀ´×ª¹«£¬Ê¹ÓÃXpath»òÊÇXmlDocumentµÈ¶ÔÏóÀ´Íê³É£¬µ±È»ÕâÑùÊÇ¿ÉÒԵģ¬²»¹ýÕâÑù´¦ÀíÆðÀ´¾Í»á³öÏֺܶàÎÊÌ⣬±ÈÈç˵Êý¾Ý¿â±ä»¯£¬Èç¹ûÖ»ÓÐÊý¾Ý±ä»¯ÄÇ·½±ã£¬Ð´Ò»¸öͨÓõÄÀ࣬ÿ´Î²éѯǰ¸üÐÂXmlÎļþ¾Í¿ÉÒÔÁË£¬µ«Èç¹û³öÏÖÊý¾Ý¿â½á¹¹µÄ±ä»¯¾Í»áºÜ³ÔÁ¦ÁË£¬ÄÇôÓÐûÓÐÒ»ÖÖ·½·¨£¬°ÑÊý¾ÝÔÚµ÷³öÊý¾Ý¿â֮ǰ¾Íת»¯ÎªXmlµÄÄØ£¬Õâ¸öÊǵ±È»µÄ£¬¾ÍÊÇÎÒÃǵÄFor¡¡Xml£¬´ó¼ÒÔÚ²éѯ·ÖÎöÆ÷Àï×ö±í½á¹û²éѯµÄʱºòÒ»°ãÊÇÕâÑùдµÄ
  
   ÎÒÃǸø´ó¼ÒչʾһÏÂÎÒËùÓõ½µÄÁ½¸ö±í°É
   µÚÒ»¸ö±í°à¼¶ÐÅÏ¢±íClassInfo£¨°à¼¶ÐÅÏ¢±íÒ»¹²Èý¸ö×Ö¶ÎCID ±¾±íID,Cnumber °à¼¶ÈËÊý,CName °à¼¶Ãû³Æ£©
  
 µÚ¶þ¸ö±í ÉúÐÅÏ¢±í Students £¨CID °à¼¶±íÍâ¼ü£¬SIDѧÉúÐÅÏ¢±íIDѧÉúµÄѧºÅ¾ÍÊÇ£¬SName£©
SELECT CID,Cnumber,CName from ClassInfo WHERE CName='²©¿ÍÔ°Ò»°à'
 ½á¹ûΪ£º
ͨ³£ÊÇÕâÖÖ·½·¨£¬»òÊÇÔÙ¼ÓÉϸöOrder BY ʲôµÄ£¬»òÊÇÏñinner join µÈ²éѯµÄ¶«¶«£¬ÆäʵÎÒÃÇÖ»ÒªÔÚÕâÌõÓï¾äÉÏÉÙÁ¿µÄ¸Ä¶¯Ò»Ï¾ͿÉÒԵõ½ÎÒÃÇÏëÒªµÄXmlÊý¾ÝÁË£¬Ò²Ðí ÓÐÅóÓÑÒѾ­Ïëµ½ÁËÊÇ For Xml ¶Ô¾ÍÊÇÕâÑùµÄ
SELECT CID,Cnumber,CName from ClassInfo WHERE CName='²©¿ÍÔ°Ò»°à'   FOR xml raw
 ÕâÑù²éѯµÃµ½µÄ½á¹ûÈçÏ£º
ÎÒÃÇÈç¹ûÏë¿´µÄ¸üÇå³þµÄ»°Ö»Òªµ¥»÷Ò»¸ö¾Í¿ÉÒԵõ½ÏàÓ¦µÄXmlÎļþµÄÐÎʽÁË
ÕâÀïÓ¦¸Ã¾ÍÊÇÎÒÃÇÏëÒªµÄXmlÎļþµÄÐÎʽÁË£¬Æäʵ¾ÍÊÇÕâô¼òµ¥µÄ£¬ÎÒÃÇ¿ÉÒÔͨ¹ýAdoµÄ·½Ê½ °ÑËû²éѯµÃµ½UIÖ±½ÓʹÓþÍOKÁË£¬
ÎÒÃÇ¿ÉÒÔ¿´µ½ÎÒÃǵõ½µÄÐÅÏ¢²¢²»ÍêÕû£¬Ã»ÓÐѧÉúÐÅÏ¢£¬ÎÒÃÇÒª°ÉʹÓÃÒ»¸öÁ¬½ÓµÄÐÎʽÀ´Íê³É¿´ÏÂÃæµÄSqlÓï¾ä
SELECT ClassInfo.CID,ClassInfo.Cnumber,ClassInfo.CName,Students.SID,Students.SName
from ClassInfo  JOIN dbo.Students ON Students.CID=dbo.ClassInfo.CID 
ORDER BY&n


Ïà¹ØÎĵµ£º

sqlÓï¾ä¼¯½õ

Ò»¡¢Ö÷ÒªÊÇÐèÒª¸üÐÂmssqlServer µÄʱºòÐèÒª½øÐÐһЩÊÇ·ñ´æÔÚµÄÅжϣ¬ÔÚmssql2000 ºÍ 2005 ÉϲâÊÔûÓÐŶÎÊÌâ
--//ÅжÏÊDZíTable_UserInfoÀïÊÇ·ñÓÐ×Ö¶Î
if not exists(select * from syscolumns where id=object_id('Table_UserInfo') and name='Tel') begin
ALTER table Table_UserInfo add Tel varchar(200)--Ôö¼Ó×ֶΠ......

SQL Server 2005ÐÂÔöµÄ¹¦ÄÜ

1. еIJúÆ·°æ±¾
³ýSQL Server 2005±ê×¼°æºÍÆóÒµ°æÖ®Í⣬²úÆ·ÏßÖл¹¼ÓÈëÁËSQL Server 2005¼ò»¯°æ£¨SQL Server 2005 Express£©ºÍ¹¤×÷×é°æ£¨SQL Server 2005 Workgroup£©Á½¸öа汾¡£
SQL Server 2005 Express——Æä×÷ÓÃÊÇ´úÌæ΢ÈíSQL Server×ÀÃæÒýÇ棨Microsoft SQL Server Desktop Engine£¬MSDE£©¡£SQL Serve ......

ѹËõÊý¾Ý¿âºÍ±í¡¡(SQL SERVER 2008)

Database Level
- shrinkdb
- shrinkfile
 
SQL Server 2008
1) Right click database
2) Tasks
3) Shrink
4) Database or file
 
Table level
- compression
 
SQL Server 2008
1) Right click table
2) Storage
3) Manage Compression ......

11 SQLµ÷ÓŸÅÊö

11.3µ÷ÓųÌÐò/¼õÇḺÔØ
Èç¹ûÆÚÍû¼õÇáÊý¾Ý¿â·þÎñÆ÷ÕûÌåµÄCPU»òÕßI/O¸ºÔØ£¬¿Éͨ¹ýÒÔϲ½ÖèÈ·¶¨×ÊÔ´Ãܼ¯Ð͵ÄSQLÓï¾ä£º
1.Ñ¡ÔñÔÚÓ¦ÓóÌÐòµÄ´¦Àí¸ß·åÆÚ¼ì²â¡£
2.ÔÚÒÔÉÏÖÜÆÚÄÚ£¬ÊÕ¼¯²Ù×÷ϵͳ¼°Oracleͳ¼ÆÐÅÏ¢¡£ÐèÒªÊÕ¼¯µÄOracleͳ¼ÆÐÅÏ¢ÖÁÉÙ°üÀ¨ÎļþµÄI/O£¨Í¨¹ýÊÓͼV$FILESTAT£©£¬ÏµÍ³Í³¼ÆÐÅÏ¢£¨V$SYSSTAT£©£¬ÒÔ¼°SQLͳ¼ÆÐÅÏ¢£ ......

xmlµÄÐòÁл¯ºÍ·´ÐòÁл¯

XMLÐòÁл¯Óë·´ÐòÁл¯ ÕûÀíÎĵµ
XMLÐòÁл¯Óë·´ÐòÁл¯
    // OBJECT -> XML
    public static void SaveXml(string filePath, object obj) { SaveXml(filePath, obj, obj.GetType()); }
    public static void SaveXml(string filePath, object obj, System.Type ty ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ