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

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

ÎÄÕµ¼º½ SQL Server 2005 ѧϰ±Ê¼ÇϵÁÐÎÄÕµ¼º½
     ÔÚSQl 2005 For XMl ¼òµ¥²éѯ(Raw£¬Auto£¬Pathģʽ)(1) ÀïÎÒÃÇ˵Á˹ØÓÚPath£¬RawºÍAutoģʽµÄÓ÷¨£¬ÆäʵÀïÃæ²»½ö½ö ÊÇÕâЩ¼òµ¥µÄ²Ù×÷£¬»¹ÓÐһЩÆäËüµÄÌØÐÔ£¬±ÈÈç˵Type»òOpenXml·½·¨£¬sp_xml_preparedocument´æ´¢¹ý³Ì µÈÕâЩÔö¼ÓµÄ¶«¶«£¬ÎÒÃÇÀ´Ò»¸öÒ»¸öµÄ¿´°É£¬
    µÚÒ»¸öType¹Ø¼ü×Ö£¬Type´ó¼Ò¶¼ ÖªµÀ Ó¢ÎÄÒâ˼ÊÇÀàÐÍ£¬ÔÚÕâÀïÒ²ÊǺÍÀàÐÍÏà¹ØµÄ£¬Òâ˼¾ÍÊÇ˵ÈÃ×Ó¼¯ÀïÃæÀàÐͺͼ¯ºÏµÄÀàÐÍͳһ£¬¾ßÌå ÊÇÔõôͳһµÄÕâ¸öÎÒÒ²²»¶®£¬´ó¼Ò»¹µÃ×Ô¼ºÈ¥²é»òÊÇÕÒÕÒMSµÄÍøÕ¾°É£¬ÎÒÃÇ»¹ÓÃÉÏÒ»½ÚµÄÊý¾Ý¿âºÍ±íÀ´ÊµÏÖ¾ßÌå±íµÄ½á¹¹»¹Çë´ó¼Ò²Î¿¼SQl 2005 For XMl ¼òµ¥²éѯ(Raw£¬Auto£¬Pathģʽ)(1)ÀïÃæµÄ   ÎÒÃÇÀ´×öдһ¸öÕâÑùµÄ×Ó²éѯ
             
SELECT SID,SName,(SELECT ClassInfo.CName from ClassInfo  WHERE ClassInfo.CID=Students.CID  FOR xml raw)
from Students
ORDER BY CID FOR xml auto 
      ÎÒÃÇ¿ÉÒÔÇå³þµÄ¿´µ½×Ó²éѯ·µ»ØµÄÊÇÒ»¸öXmlÀàÐ͵ĶøÍâÃæµÄ¼¯ºÏÒ²ÊÇÒ»¸öXmlÀàÐ͵ģ¬Õâ¸öʱºòÈç¹ûÎÒÃÇÖ±½ÓÖ´ÐеĻ°¾Í»á·¢Éú´íÎó
  ÏûÏ¢ 6809£¬¼¶±ð 16£¬×´Ì¬ 1£¬µÚ 1 ÐÐ
      ²»Äܽ«Î´ÃüÃûµÄ±íÓÃ×÷ XML ±êʶ·û£¬Ò²²»Äܽ«Î´ÃüÃûµÄÁÐÓÃÓÚÊôÐÔÃû³Æ¡£ÇëÔÚ SELECT Óï¾äÖÐʹÓà AS ¶ÔδÃüÃûµÄÁÐ/±í½øÐÐÃüÃû¡£
    ÎÒÃÇÖªµÀ Èç¹ûÊÇÕý³£µÄÇé¿öÏÂÊÇ¿ÉÒԵģ¬Î޷ǾÍÊÇÕâÒ»ÁÐûÓÐÁÐÃû£¬µ«ÊÇÊDz»»á±¨´íµÄ£¬ÄÇÕâ¸öʱºòÎÒÃǾͿÉÒÔÕâÑùÀ´Ð´ÁË
  
SELECT SID,SName,(SELECT ClassInfo.CName from ClassInfo  WHERE ClassInfo.CID=Students.CID  FOR xml raw,type)
from Students
ORDER BY CID FOR xml auto
   Ö»ÒªÔÚ×Ó¼¯µÄºóÃæ¼ÓÉÏÒ»¸öType¾Í¿ÉÒÔÁË£¬ÎÒÃǵÄType¾ÍÊÇÔÚÕâÖÖÇé¿öÏÂʹÓõģ¬Ò²¿ÉÄÜÊÇÎÒÁ˽âµÄÌ«ÉÙÁË£¬ÎÒ¸öÈ˸оõ Õâ¸ö¶«¶«ÊÇûÓÐʲô̫´óµÄÓô¦µÄ£¬ÎÒÃÇ¿ÉÒÔÕâÑùÀ´Ð´
SELECT SID,SName,(SELECT ClassInfo.CName from ClassInfo  WHERE ClassInfo.CID=Studen


Ïà¹ØÎĵµ£º

Java·ÀÖ¹SQL×¢Èë

 SQL×¢ÈëÊÇ×î³£¼ûµÄ¹¥»÷·½Ê½Ö®Ò»,Ëü²»ÊÇÀûÓòÙ×÷ϵͳ»òÆäËüϵͳµÄ©¶´À´ÊµÏÖ¹¥»÷µÄ,¶øÊdzÌÐòÔ±ÒòΪûÓÐ×öºÃÅжÏ,±»²»·¨
Óû§×êÁËSQLµÄ¿Õ×Ó,ÏÂÃæÎÒÃÇÏÈÀ´¿´ÏÂʲôÊÇSQL×¢Èë:
          ±ÈÈçÔÚÒ»¸öµÇ½½çÃæ,ÒªÇóÓû§ÊäÈëÓû§ÃûºÍÃÜÂë:
     & ......

SQLÄ£ºý²éѯÓï·¨LIKE


Ö´ÐÐ Êý¾Ý¿â²éѯʱ£¬ÓÐÍêÕû²éѯºÍÄ£ºý²éѯ֮·Ö¡£
Ò»°ãÄ£ºýÓï¾äÈçÏ£º
SELECT ×ֶΠfrom ±í WHERE ij×ֶΠLike Ìõ¼þ
ÆäÖйØÓÚÌõ¼þ£¬SQLÌṩÁËËÄÖÖÆ¥Åäģʽ£º
1£¬%£º±íʾÈÎÒâ0¸ö»ò¶à¸ö×Ö·û¡£¿ÉÆ¥ÅäÈÎÒâÀàÐͺͳ¤¶ÈµÄ×Ö·û£¬ÓÐЩÇé¿öÏÂÈôÊÇÖÐÎÄ£¬ÇëÔËÓÃÁ½¸ö°Ù·ÖºÅ£¨%%£©±íʾ¡£
±ÈÈç SELECT * from [user] WHERE u_na ......

javaʵÏÖ¶ÁÈ¡XMLÎļþÊý¾Ý²åÈëµ½Êý¾Ý¿âÖÐ

package com.flxx.docUrl;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;
import org.jdom.output.Format;
import org.jd ......

ʹÓÃ×Ô¶¨Òå±íÀàÐÍ£¨SQL Server 2008£©

ʹÓÃ×Ô¶¨Òå±íÀàÐÍ£¨SQL Server 2008£©
http://tech.ddvip.com    2009Äê09ÔÂ19ÈÕ    À´Ô´£º²©¿ÍÔ°    ×÷Õߣº³ÂÏ£Õ   
¡¡¡¡ÔÚ SQL Server 2008 ÖУ¬Óû§¶¨Òå±íÀàÐÍÊÇÖ¸Óû§Ëù¶¨ÒåµÄ±íʾ±í½á¹¹¶¨ÒåµÄÀàÐÍ¡£Äú¿ÉÒÔʹÓÃÓû§¶¨Òå±íÀàÐÍΪ´æ´¢¹ý³Ì»òº¯ÊýÉùÃ÷±íÖµ²ÎÊý£¬»òÕßÉùÃ÷ÄúÒªÔÚ ......

SQL SERVER2008Êý¾ÝÍÚ¾ò


¸ÅÊö
Microsoft SQL Server 2008 ÈÃÄúÄܹ»Í¨¹ýÖ±¹ÛµÄÊý¾ÝÍÚ¾òµÄÔ¤²âÐÔ·ÖÎöÀ´×ö³öÃ÷ÖǺÏÀíµÄ¾ö²ß£¬ÎÞ·ìµØÕûºÏ Microsoft ÉÌÒµÖÇÄÜƽ̨²¢¿ÉÀ©Õ¹ÖÁÉÌÒµÓ¦ÓóÌÐò¡£
ÖØ´óµÄй¦ÄÜ
ͬʱÀûÓôíÎóºÍ¾«È·¶ÈµÄͳ¼Æ·ÖÊýÀ´²âÊÔ¶à¸öÊý¾ÝÍÚ¾òÄ£ÐÍ£¬²¢ÀûÓý»²æÑéÖ¤À´È·ÈÏÆäÎȶ¨ÐÔ
ÔÚµ¥Ò»½á¹¹Öн¨Á¢¶à¸ö²»¼æÈݵÄÍÚ¾òÄ£ÐÍ¡¢ÔÚɸѡ¹ýµÄÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ