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

SQL 2005ÖÐÓÃXML nodes()º¯ÊýÈ¡´úOPENXML

SQL Server 2005ΪXMLÌṩ±¾µØÖ§³Ö;ÏÖÔÚ¿ÉÒÔÔÚOPENXML½ÚµãÖÐʹÓÃÒ»¸ö´øÓÐnodes()º¯ÊýµÄXML×Ö¶ÎÀàÐͰÑÒ»¸öXMLÎļþת»¯ÎªÒ»¸öÐм¯¡£ÈÃÎÒÃÇÀ´¿´Ò»¸öʹÓÃOPENXMLµÄ¼òµ¥Àý×Ó£¬²¢ÏÔʾÈçºÎ°ÑËüת»¯ÎªÔÚSQL Server 2005ÖÐʹÓÃXML×Ö¶ÎÀàÐͺÍnodes()º¯Êý¡£
¡¡¡¡ÎªÁËʹÎÒÃǵÄÀý×Ó¼òµ¥»¯£¬ÎÒÃǽ«¼ÙÉèÎÒÃÇÐèÒªÖ´ÐÐijÖÖ»ùÓڲɹº¶©µ¥ÁбíµÄ¹ý³Ì£¬¶øÕâ¸ö²É¹º¶©µ¥½«ÔÚÒ»¸öXMLÎļþÖÐÖ¸¶¨¡£¸ÃXMLÎļþÀàËÆÓÚÕâÑù£º
¡¡¡¡ < polist>
¡¡¡¡< po>< ponumber>100< /ponumber>< podate>2008-09-10< /podate>< /po>
¡¡¡¡< po>< ponumber>101< /ponumber>< podate>2008-09-11< /podate>< /po>
¡¡¡¡< /polist>
¡¡¡¡ÎÒÃÇ¿ÉÒÔͨ¹ýÏÂÃæµÄOPENXML°Ñ XMLת»¯ÎªÒ»¸öÐм¯£º
¡¡¡¡ DECLARE @DocHandle int
¡¡¡¡DECLARE @XmlDocument nvarchar(1000)
¡¡¡¡SET @XmlDocument = N''< polist>
¡¡¡¡< po>< ponumber>100< /ponumber>< podate>2008-09-10< /podate>< /po>
¡¡¡¡< po>< ponumber>101< /ponumber>< podate>2008-09-11< /podate>< /po>
¡¡¡¡< /polist>''
¡¡¡¡EXEC sp_xml_preparedocument @DocHandle OUTPUT, @XmlDocument
¡¡¡¡SELECT * from OPENXML (@DocHandle, ''/polist/po'',2)
¡¡¡¡WITH (ponumber nvarchar(10),
¡¡¡¡podate datetime)
¡¡¡¡EXEC sp_xml_removedocument @DocHandle
¡¡¡¡ÏÂÃæÊÇÖ´ÐÐÒÔÉÏ´úÂë¶ÎµÃµ½µÄÐм¯£º
¡¡¡¡
¡¡¡¡Í¼Ò»
¡¡¡¡ÕâÊÇ´ÓÉÏÃæ´úÂë¶ÎµÃµ½µÄÒªµã£º
¡¡¡¡Ê¹ÓÃOPENXMLµÄµÚÒ»²½ÊÇͨ¹ý·ÃÎʸô洢¹ý³Ìsp_xml_preparedocumentÀ´"×¼±¸"XMLÎļþ£¬¸Ã´æ´¢¹ý³Ì½«·µ»ØÒ»¸öÈ·ÈÏ×¼±¸ºÃµÄXMLµÄÕûÊý¡£
¡¡¡¡OPENXMLÊÇÒ»¸öÐм¯ÌṩÕߣ¬ÕâÒâζ×ÅÈç¹ûËüÊÇÒ»ÕÅ±í£¬ÄÇôÄãͬÑù¿ÉÒÔʹÓÃËü¡£±¾ÖÊÉÏËüÊÇÒ»¸ö´øÓвÎÊýµÄº¯Êý£¬ÕâЩ²ÎÊý½«È·¶¨¸Ã´ÓXMLÎļþÖÐÌáȡʲô¡£
¡¡¡¡Ê¹ÓÃOPENXMLµÄ×îºó²½ÖèÊÇͨ¹ý·ÃÎÊ´æ´¢¹ý³Ìsp_xml_removedocumentÀ´"ÊÍ·Å"×¼±¸ºÃµÄXMLÎļþ¡£
ÉÏÃæµÄxml´æ´¢¹ý³ÌʹÓù²Í¬µÄMSXML½âÎö×é¼þ¡£
¡¡¡¡sp_xml_preparedocument´æ´¢¹ý³Ì°Ñ×¼±¸ºÃµÄXMLÎļþ´æ´¢ÔÚSQL ServerµÄÄÚ²¿¸ßËÙ»º´æÖС£·ÃÎÊsp_xml_removedocument´æ´¢¹ý³ÌÊǺÜÓбØÒªµÄ£¬ÕâÊÇΪÁ˰Ñ×¼±¸ºÃµÄXMLÎļþ´Ó¸ßËÙ»º´æÖÐÏû³ý¡£¸ù¾ÝSQL Server 2005Áª»ú°ïÖú£¬Äܹ»ÓÃÓÚSQL ServerµÄ°Ë·ÖÖ®Ò»×ÜÄÚ´æ¿ÉÒÔÓÃÓÚMSX


Ïà¹ØÎĵµ£º

SQL²éѯÓï¾ä¾«»ªÊ¹ÓüòÒª

Ò»¡¢ ¼òµ¥²éѯ
¼òµ¥µÄTransact-SQL²éѯֻ°üÀ¨Ñ¡ÔñÁÐ±í¡¢from×Ó¾äºÍWHERE×Ӿ䡣ËüÃÇ·Ö±ð˵Ã÷Ëù²éѯÁС¢²éѯµÄ
±í»òÊÓͼ¡¢ÒÔ¼°ËÑË÷Ìõ¼þµÈ¡£
ÀýÈ磬ÏÂÃæµÄÓï¾ä²éѯtesttable±íÖÐÐÕÃûΪ“ÕÅÈý”µÄnickname×ֶκÍemail×ֶΡ£
SELECT nickname,email
from testtable
WHERE name='ÕÅÈý'
(Ò») Ñ¡ÔñÁбí
Ñ¡ÔñÁбí ......

.NET SQLServer2005 XML×Ö¶Î

//ÕâÊÇÌí¼Ó 
private void button1_Click(object sender, EventArgs e)
        {
            string s = "Persist Security Info=False;Integrated Security=SSPI;database=IIntegration;server=(local)";
 &n ......

ÈýÖÖSQL·ÖÒ³·¨

±íÖÐÖ÷¼ü±ØÐëΪ±êʶÁУ¬[ID] int IDENTITY (1,1)
1.·ÖÒ³·½°¸Ò»£º(ÀûÓÃNot InºÍSELECT TOP·ÖÒ³)
Óï¾äÐÎʽ£º 
SELECT TOP Ò³¼Ç¼ÊýÁ¿ *
from ±íÃû
WHERE (ID NOT IN
  (SELECT TOP (ÿҳÐÐÊý*(Ò³Êý-1)) ID
  from ±íÃû
  ORDER BY ID))
  ORDER BY ID
//×Ô¼º»¹¿ÉÒÔ¼ÓÉÏһЩ²éѯ ......

java½«excelµ¥Ôª¸ñÊý¾Ýת»»³ÉsqlÓï¾ä

Ê×ÏÈÒªÓÐjxlÀà¿â¡£
³ÌÐòÈçÏ£º
import java.io.*;
import jxl.*;
public class ExcelToSql {
  public static void main(String args[])
  {
   try
   {
    Workbook book= Workbook.getWorkbook(new File("D:\\workspaceuse6\\foundation\\test\\com\\gres ......

SQL ServerÈçºÎÌá¸ßÊý¾Ý¿â»¹Ô­µÄËÙ¶È

Ó°ÏìÊý¾Ý¿â»¹Ô­ËٶȵÄÒòËØºÍÓ°ÏìÊý¾Ý¿â±¸·ÝËٶȵÄÒòËØÏàͬ¡£³ý´ËÖ®Í⣬¼ÙÈçÄãʹÓÃSQL Server 2005µÄ»°£¬Ä㻹¿ÉÒÔÆô¶¯ÁíÍâÒ»¸öÓÅ»¯ÈÎÎñÀ´»¹Ô­µ±Ç°²»´æÔÚµÄÊý¾Ý¿â£¬ÔËÐл·¾³ÎªWindows XP£¬Windows 2003 Server »ò¸üа汾¡£
Perform Volume Maintenance Tasks
µ±Ä㻹ԭһ¸öеÄÍêÕûÊý¾Ý¿âÊÇ£¬SQL Server¶Á±¸·ÝÎļþÍ·£¬È»ºó´ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ