| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> mssql >> SQL Server 2000 shu ju ku FOR XML cha xun gai shu
 

SQL Server 2000 shu ju ku FOR XML cha xun gai shu

2008-07-18 06:17:33 编辑來源:互联网 评论
 
本文为【SQL Server 2000数据库FOR XML查询概述】的拼音翻译版
  you yu XML ben shen de zhu duo you dian ,XML ji shu yi bei guang fan de shi yong , mu qian de hao duo ruan jian ji shu tong XML jin mi xiang guan , bi ru wei ruan de .net ping tai dui xml ti gong le qiang da de zhi chi , ti gong System.Xml yi ji qi zi ming ming kong jian xia de lei xing lai cao zuo xml。Ado.net tong guo gai xin lei xing DataSet chu se de ba guan xi xing shu ju ku tong xml jin xing le jin mi ji cheng 。 you yu ping chang xu duo kai fa ren yuan shi yong .net lai cao zuo SQL Server de dao shu ju ji hou zai zhuan huan cheng xml, suo yi wang wang hu lue Transact-SQL cha xun sheng cheng XML shu ju de qiang da gong neng 。 dui yu yi xie xiang mu shi yong XML cha xun zhi jie tong guo SQL sheng cheng xml hui lai de geng wei jian bian , suo yi wo tong guo zai shi ji xiang mu zhong de shi yong he cha yue yi xie zi liao xie cheng yi ge zhi shi dian , yi shi wen gu er zhi xin , er shi dui yu yi xie kai fa zhe gang hao xu yao zhe fang mian de ji shu er huan mei you zhao dao bi jiao kuai jie de xue xi fang shi ti gong yi tiao tu jing 。
  zai SQL SERVER 2000 zhong cha xun sheng cheng XML de yu fa biao da shi bi jiao jian jie , zheng ge yu fa ru xia :
  SELECT
  FROM
  WHERE
  FOR XML AUTO | RAW | EXPLICIT [,XMLDATA ] [,ELEMENTS] [,BINARY BASE64]
  xia mian wo jiang yi Northwind shu ju ku lai yan shi shang mian de biao da shi zhong suo bao han de ge xiang gong neng , xia mian de cha xun yu ju he fan hui jie guo dou tong guo SQL SERVER 2000 cha xun fen xi qi lai zhi xing he de dao 。
  yi . shi yong AUTO mo shi
  gai mo shi wo ren wei zai sheng cheng dan biao xml shu ju fang mian shi yong de zui duo de , neng man zu yi ban de xu yao 。 xian lai kan ta de jian dan cha xun 。
  1. jian dan cha xun
  cha xun yu ju :
  SELECT CategoryID,
  CategoryName
  FROM Categories
  WHERE CategoryID < 3 FOR XML AUTO
  fan hui jie guo :
  ye ke yi shi yong bie ming ,
  cha xun yu ju :
  SELECT CategoryID AS ID,
  CategoryName,
  GetDate() as CurrDate
  FROM Categories MyTable
  WHERE CategoryID < 3 FOR XML AUTO
  fan hui jie guo :
  2. lian jie cha xun
  yi liang ge biao wei li ,
  cha xun yu ju :
  SELECT Categories.CategoryID,
  Categories.CategoryName,
  ProductID,
  ProductName
  FROM Categories
  JOIN Products ON Categories.CategoryID = Products.CategoryID AND ProductID <5
  WHERE Categories.CategoryID < 3 FOR XML AUTO
  fan hui jie guo :
  
  ke yi kan dao biao lian jie cha xun ke yi sheng cheng fen ceng ci de Xml, bu guo xu yao zhu yi de shi SELECT zi ju zhong de fu biao de lie yao pai zai zi biao de lie de qian mian , fou ze hui chu xian ni bu xiang kan dao de jie guo , ru :
  cha xun yu ju :
  SELECT ProductID,Categories.CategoryID,Categories.CategoryName,ProductName
  FROM Categories
  JOIN Products ON Categories.CategoryID = Products.CategoryID and ProductID <5
  WHERE Categories.CategoryID <3 FOR XML AUTO
  fan hui jie guo :
  
  
  
  3. shi yong ELEMENTS xuan xiang
  shi yong gai xuan xiang ke yi sheng cheng yi yuan su wei zhong xin de Xml biao shi , mo ren wei shu xing fang shi , bu guo shu xing fang shi jie sheng kong jian 。 xu yao zhu yi de shi shi yong ELEMENTS xuan xiang shi yi zhong quan shi huo quan fou de xing shi , bu neng de dao yi bu fen shi yi yuan su biao shi er ling yi bu fen yi shu xing biao shi de Xml shu ju 。
  cha xun yu ju :
  SELECT CategoryID,
  CategoryName
  FROM Categories
  WHERE CategoryID < 3
  FOR XML AUTO, ELEMENTS
  fan hui jie guo :
  1
  Beverages
  2
  Condiments
  zai lian jie cha xun shi ,
  cha xun yu ju :
  SELECT Categories.CategoryID,
  ProductID,
  ProductName
  FROM Categories
  JOIN Products ON Categories.CategoryID = Products.CategoryID and ProductID <4
  WHERE Categories.CategoryID <3 FOR XML AUTO, ELEMENTS
  fan hui jie guo :
  1
  1
  Chai
  2
  Chang
  2
  3
  Aniseed Syrup
  4. jian suo dui er jin zhi shu ju de XPath yin yong
  zhe shi dui er jin zhi shu ju de cao zuo ,
  cha xun yu ju :
  SELECT CategoryID,
  Picture
  FROM Categories
  WHERE CategoryID = 1
  FOR XML AUTO
  fan hui jie guo :
  shi yong ELEMENTS fang shi ,
  cha xun yu ju :
  SELECT CategoryID,
  Picture
  FROM Categories
  WHERE CategoryID = 1
  FOR XML AUTO,ELEMENTS
  fan hui jie guo :
  1
  dbobject/Categories[@CategoryID='1']/@Picture
  er . shi yong RAW mo shi
  shi yong RAW mo shi bu neng shi yong ELEMENTS xuan xiang 。
  1. jian dan cha xun
  cha xun yu ju :
  SELECT CategoryID,
  CategoryName AS Nanme
  FROM Categories
  WHERE CategoryID < 3
  ORDER BY CategoryID DESC
  FOR XML RAW
  fan hui jie guo :
  2. lian jie cha xun
  cha xun yu ju :
  SELECT Categories.CategoryID,
  Categories.CategoryName,
  ProductID,
  ProductName
  FROM Categories
  JOIN Products ON Categories.CategoryID = Products.CategoryID and ProductID <4
  WHERE Categories.CategoryID <= 2 FOR XML RAW
  fan hui jie guo :
  
  san . shi yong EXPLICIT mo shi
  gai mo shi shi yong qi lai xiang dui bi jiao fu duo , bu guo ta ke yi hen ling huo de kong zhi fan hui de xml shu ju jie gou 。 zai gai cha xun zhong ding yi le liang ge biao shi yuan shu ju de e wai lie 。Tag lie wei yi de que ding yong lai zai jie guo zhong biao shi mei yi xing de xml biao ji ,Parent lie yong lai kong zhi yuan su zhi jian de qian tao guan xi 。
  1. shi yong tong yong biao
  EXPLICIT mo shi xia you yi ge tong yong biao de gai nian , shi yong shu ju lie de ming cheng lai ding yi xml wen dang zhong de shu ju 。 jie gou ru xia :
  ElementName!TagNumber!AttributeName!Directive
  xia mian de shuo ming lai zi lian ji cong shu ,
  ElementName
  shi suo de dao de yuan su lei shu biao shi fu ( li ru , ru guo jiang Customers zhi ding wei ElementName, ze shi yuan su biao ji )。
  TagNumber
  shi yuan su de biao ji hao 。 jie zhu yu tong yong biao zhong de liang ge yuan shu ju lie (Tag he Parent),TagNumber yong yu biao shi XML shu zhong de XML yuan su qian tao 。 mei ge TagNumber dou zhun que dui ying yu yi ge ElementName。
  AttributeName
  shi XML te xing de ming cheng ( ru guo mei you zhi ding Directive) huo bao han de yuan su ming ( ru guo Directive shi xml、cdata huo element)。 ru guo zhi ding Directive, ze AttributeName ke yi wei kong 。 zhe zhong qing kuang xia , lie zhong bao han de zhi zhi jie you ju you zhi ding ElementName de yuan su suo bao han 。
  Directive
  shi ke xuan ming ling 。 ru guo mei you zhi ding Directive, ze bi xu zhi ding AttributeName。 ru guo mei you zhi ding AttributeName qie mei you zhi ding Directive( ru Customer!1), ze biao shi yuan su ming ling ( ru Customer!1!!element) qie bao han shu ju 。
  Directive you liang zhong yong tu 。 gai xuan xiang yong yu fen bie shi yong guan jian zi ID、IDREF he IDREFS dui ID、IDREF he IDREFS jin xing bian ma 。 huan yong yu biao shi ru he shi yong guan jian zi hide、element、xml、xmltext he cdata jiang zi fu chuan shu ju yang she dao XML。 da duo shu qing kuang xia yuan xu zai zhe xie zu zhong zu he zhi ling , dan shi bu neng zai zu ben shen zhong jin xing zu he 。
  ID
  ke jiang yuan su te xing zhi ding wei ID lei xing de te xing 。 ran hou ke yi shi yong IDREF he IDREFS te xing yin yong ta men , yi qi yong wen dang nei de lian jie 。 dan shi , ru guo mei you qing qiu XMLDATA, ze ci guan jian zi wu xiao 。
  IDREF
  zhi ding wei IDREF de te xing ke yong yu yin yong ID lei xing de te xing , yi qi yong wen dang nei de lian jie 。 dan shi , ru guo mei you qing qiu XMLDATA, ze ci guan jian zi wu xiao 。
  IDREFS
  zhi ding wei IDREFS de te xing ke yong yu yin yong ID lei xing de te xing , yi qi yong wen dang nei de lian jie 。 dan shi , ru guo mei you qing qiu XMLDATA, ze ci guan jian zi wu xiao 。
  hide
  bu xian shi te xing 。 zhe dui yu an zhao bu chu xian zai jie guo zhong de te xing dui jie guo jin xing pai xu ke neng hen you yong 。
  element
  bu sheng cheng te xing 。 er shi sheng cheng ju you zhi ding ming cheng de bao han yuan su ( ru guo mei you zhi ding te xing ming ze zhi jie sheng cheng bao han yuan su )。 bao han shu ju bei bian ma wei shi ti ( li ru , zi fu < bian cheng <)。 gai guan jian zi ke yi yu ID、IDREF huo IDREFS zu he 。
  xml
  chu le bu jin xing shi ti bian ma wai , gai ming ling yu yuan su ming ling xiang tong ( li ru , zi fu < reng shi <)。 chu le hide wai , gai ming ling bu neng yu ren he qi ta ming ling yi qi shi yong 。
  xmltext
  lie nei rong ying bao zai dan ge biao ji nei , yi bian yu wen dang de qi ta bu fen ji cheng 。 ru guo zhi ding le AttributeName, ze biao ji ming you zhi ding ming cheng ti huan ; fou ze tong guo jiang nei rong fang zai rong qi de qi shi chu er bu jin xing shi ti bian ma , jiang te xing zhui jia dao bao han yuan su de dang qian te xing lie biao 。 han you gai ming ling de lie bi xu shi wen ben lei xing (varchar、nvarchar、char、nchar、text、ntext)。 gai ming ling zhi neng yu hide yi qi shi yong 。 zai ti qu cun chu zai lie zhong de yi chu shu ju shi gai ming ling hen you yong 。 ru guo nei rong bu shi you xiao de XML, ze gai xing wei bu ming que 。
  cdata
  tong guo yong CDATA jie huan rao shu ju lai bao han shu ju 。 bu dui nei rong jin xing shi ti bian ma 。 yuan shi shu ju lei xing bi xu shi wen ben lei xing (varchar、nvarchar、text、ntext)。 gai ming ling zhi neng yu hide yi qi shi yong 。 dang shi yong gai ming ling shi , bu ying zhi ding AttributeName。
  2. jian dan cha xun
  zai zhi ding shu ju suo zai de yuan su de ming cheng he biao ji shi bi xu shi yong ElementName shen shu he Tag shen shu , ye jiu shi cha xun yu ju zhong biao zhong cun zai de mei yi ge shi ji de shu ju lie dou bi xu yi ElementName!Tag kai tou 。 zai mei you zhi ding AttributeName!Directive de qing kuang xia yi yuan su zhi de xing shi fan hui 。 zai zhi cha xun yi ge biao de qing kuang xia Tag wei 1,Parent wei NULL。
  shi yong EXPLICIT mo shi lai cha xun shu ju wo ren wei shi yong dao tui de fang shi hui bi jiao fang bian yi xie , bi ru wo yao de dao ru xia jie gou ,
  Description
  cha xun yu ju :
  SELECT 1 AS Tag,NULL AS Parent,
  CategoryID AS [Category!1!ID],
  CategoryName AS [Category!1!Name],
  Description AS [Category!1]
  FROM Categories
  WHERE categoryID > 6 FOR XML EXPLICIT
  fan hui jie guo :
  Dried fruit and bean curd
  Seaweed and fish
  dang ran xia mian de yu ju tong shang mian de deng xiao ,
  SELECT 1 Tag,NULL Parent,
  CategoryID [Category!1!ID],
  CategoryName [Category!1!Name],
  Description [Category!1]
  FROM Categories
  WHERE categoryID > 6 FOR XML EXPLICIT
  2. lian jie cha xun
  zai EXPLICIT mo shi xia de duo biao lian jie cha xun ke neng xiang dui bi jiao fu duo xie , xian lai kan yi ge jian dan de li zi ,
  cha xun yu ju :
  SELECT 1 AS Tag,NULL AS Parent,
  Categories.CategoryID AS [Category!1!ID],
  Categories.CategoryName AS [Category!1!!element],
  ProductID AS [Category!1!ProductID!element],
  ProductName AS [Category!1!ProductName!element]
  FROM Categories
  JOIN Products ON Categories.CategoryID = Products.CategoryID AND ProductID <5
  WHERE Categories.CategoryID < 3 FOR XML EXPLICIT
  fan hui jie guo :
  Beverages
  1
  Chai
  Beverages
  2
  Chang
  Condiments
  3
  Aniseed Syrup
  Condiments
  4
  Chef Anton&apos;s Cajun Seasoning
  cong shang mian de jie gou ke yi kan chu shu ju de xml jie gou bu shi hen shu fu , cun zai bi jiao da de rong yu 。 xiang xiang zhong gai jin hou de jie gou ru xia :
  3
  Aniseed Syrup
  4
  Chef Anton&apos;s Cajun Seasoning
  
  1
  Chai
  2
  Chang
  cong shang mian kan chu Category yuan su de Tag wei 1,Parent wei NULL, er Product yuan su de Tag wei 2,Parent wei 1( ji Category de Tag zhi )。 zhe li you yi ge wen ti xu yao jie jue , na jiu shi zai Tag he Parent zhong cun zai liang tao zhi , zhe li jiu xu yao shi yong UNION ALL yun suan fu lai shi xian zhe xiang gong neng ,UNION ALL yun suan fu de yi xiang gong neng jiu shi xiao chu cha xun fan hui de chong fu de xing 。 shi yong UNION ALL shi xu yao zhu yi de shi jie guo ji de lie shu bi xu xiang tong 。
  cha xun yu ju :
  SELECT 1 AS Tag,NULL AS Parent,
  CategoryID AS [Category!1!ID],
  CategoryName AS [Category!1!Name],
  NULL AS [Product!2!ProductID!element],
  NULL AS [Product!2!ProductName!element]
  FROM Categories WHERE CategoryID < 3
  UNION ALL
  SELECT 2 AS Tag,1 AS Parent,
  Categories.CategoryID AS [Category!1!ID],
  Categories.CategoryName AS [Category!1!Name],-- zhe li ke yi shi yong NULL dai ti
  ProductID AS [Product!2!ProductID!element],
  ProductName AS [Product!2!ProductName!element]
  FROM Categories
  JOIN Products ON Categories.CategoryID = Products.CategoryID AND ProductID <5
  WHERE Categories.CategoryID < 3
  ORDER BY [Category!1!ID] DESC,[Product!2!ProductID!element] ASC
  FOR XML EXPLICIT
  fan hui jie guo :
  3
  Aniseed Syrup
  4
  Chef Anton&apos;s Cajun Seasoning
  
  1
  Chai
  2
  Chang
  bu dai FOR XML EXPLICIT yu ju de jie guo wei :
  Tag Parent Category!1! ID Category!1!Name Product!2! Product!2!
  ProductID!element ProductName!element
  ---- ------- ---------- ------------ -------------------------- ----------------------------
  1 NULL 2 Condiments NULL NULL
  2 1 2 Condiments 3 Aniseed Syrup
  2 1 2 Condiments 4 Chef Anton's Cajun Seasoning
  1 NULL 1 Beverages NULL NULL
  2 1 1 Beverages 1 Chai
  2 1 1 Beverages 2 Chang
  3. shi yong EXPLICIT mo shi cha xun zhong de zhi ling
  zhe xie zhi ling shi zhi tong yong biao lie de di si bu fen , tong guo ta dui shu ju jin xing jin yi bu kong zhi 。
  1> zui chang yong de element he xml zhi ling
  tong guo gai zhi ling ba lie de shu ju xian shi wei yi ge zi yuan su er bu shi shu xing 。
  cha xun yu ju :
  SELECT 1 AS Tag,NULL AS Parent,
  CategoryID AS [Category!1!ID],
  CategoryName [Category!1!Name],
  Description [Category!1!!element]
  FROM Categories
  WHERE categoryID > 6 FOR XML EXPLICIT
  fan hui jie guo :
  Dried fruit and bean curd
  Seaweed and fish
  cha xun yu ju :
  SELECT 1 AS Tag,NULL AS Parent,
  CategoryID AS [Category!1!ID],
  CategoryName [Category!1!Name],
  Description [Category!1!Description!element]
  FROM Categories
  WHERE categoryID > 6 FOR XML EXPLICIT
  fan hui jie guo :
  Dried fruit and bean curd
  Seaweed and fish
  cha xun yu ju :
  SELECT 1 AS Tag,NULL AS Parent,
  CategoryID AS [Category!1!ID],
  CategoryName [Category!1],
  Description [Category!1!Description!element]
  FROM Categories
  WHERE categoryID > 6 FOR XML EXPLICIT
  fan hui jie guo :
  Produce
  Dried fruit and bean curd
  Seafood
  Seaweed and fish
  xml zhi ling tong element zhi ling cha bu duo , zhi shi element zhi ling hui jiang yi xie xml xia mian de fu hao jin xing bian ma , ru > bei bian ma cheng >5, er xml zhi ling bu hui 。
  2> shi yong hide zhi ling
  gai zhi ling shi yong lai chu li na xie bu xiang fan hui jie guo de lie , xu duo ren hui you yi wen jiao de mei you bi yao , zhi yao zai lie zhong bu zeng jia jiu xing le , tiao jian he pai xu ye ke yi zhi jie shi yong lie 。 wo men ke yi xiang de dao shi yong UNION ALL shi jiu yong de shang le , kan xia mian de li zi 。
  cha xun yu ju :
  SELECT 1 AS Tag,NULL AS Parent,
  CategoryID AS [Category!1!ID!hide],
  CategoryName AS [Category!1!Name],
  NULL AS [Product!2!ProductID!element],
  NULL AS [Product!2!ProductName!element]
  FROM Categories WHERE CategoryID < 3
  UNION ALL
  SELECT 2 ,1 ,
  Categories.CategoryID,
  NULL,
  ProductID,
  ProductName
  FROM Categories
  JOIN Products ON Categories.CategoryID = Products.CategoryID AND ProductID <5
  WHERE Categories.CategoryID < 3
  ORDER BY [Category!1!ID!hide] DESC,[Product!2!ProductID!element] ASC
  FOR XML EXPLICIT
  fan hui jie guo :
  3
  Aniseed Syrup
  4
  Chef Anton&apos;s Cajun Seasoning
  
  1
  Chai
  2
  Chang
  3> shi yong xmltext zhi ling
  gai zhi ling shi yong lai chu li bao han xml pian duan nei rong de shu ju lie , mei zhao dao xian cheng de biao jie gou he shu ju jin xing ce shi , suo yi jiu zai Categories biao zhong zeng jia le XmlData lie ming , lei xing wei nvarchar, mo ren zhi she zhi wei “”。
  cha xun yu ju :
  SELECT 1 AS Tag,NULL AS Parent,
  CategoryID AS [Category!1!ID],
  XmlData AS [Category!1!CustomData!xmltext]
  FROM Categories WHERE CategoryID = 8 FOR XML EXPLICIT
  fan hui jie guo :
  cha xun yu ju :
  SELECT 1 AS Tag,NULL AS Parent,
  CategoryID AS [Category!1!ID],
  XmlData AS [Category!1!!xmltext]
  FROM Categories WHERE categoryID = 8 FOR XML EXPLICIT
  fan hui jie guo :
  4> shi yong cdata zhi ling
  shi yong gai zhi ling ke yi chuang jian CDATA jie fang zhi yi xie zi fu shu ju bei xml jie xi qi 。
  cha xun yu ju :
  SELECT 1 AS Tag,NULL AS Parent,
  CategoryID AS [Category!1!ID],
  XmlData AS [Category!1!!cdata]
  FROM Categories WHERE categoryID = 6 FOR XML EXPLICIT
  fan hui jie guo :
  ]]>
  5> shi yong ID、IDREF he IDREFS zhi ling yi ji XMLDATA xuan xiang
  you yu zhe li zhi neng fan hui XDR gou jia , bu zhi chi XSD jia gou de jian suo , wo jiu zhi gei chu yi ge li zi ,
  cha xun yu ju :
  SELECT 1 AS Tag,NULL AS Parent,
  CategoryID AS [Category!1!ID!ID],
  CategoryName AS [Category!1!Name],
  NULL AS [Product!2!ProductID!IDREF],
  NULL AS [Product!2!ProductName]
  FROM Categories WHERE CategoryID < 3
  UNION ALL
  SELECT 2 ,1 ,
  Categories.CategoryID,
  NULL,
  ProductID,
  ProductName
  FROM Categories
  JOIN Products ON Categories.CategoryID = Products.CategoryID AND ProductID <5
  WHERE Categories.CategoryID < 3
  ORDER BY [Category!1!ID!ID] ,[Product!2!ProductID!IDREF]
  FOR XML EXPLICIT,XMLDATA
  fan hui jie guo :
  
  
  
  
  
  si . shi yong BINARY BASE64 xuan xiang
  shi yong gai xuan xiang ke yi jian suo er jin zhi zi duan , bi ru tu xiang shu ju yi base64 de xing shi fan hui dao xml wen dang 。
  1. shi yong RAW fang shi
  cha xun yu ju :
  SELECT CategoryID,
  Picture
  FROM Categories
  WHERE CategoryID =1
  ORDER BY CategoryID DESC
  FOR XML RAW,BINARY BASE64
  fan hui jie guo :
  2. shi yong AUTO fang shi
  cha xun yu ju :
  SELECT CategoryID,
  Picture
  FROM Categories
  WHERE CategoryID =2
  ORDER BY CategoryID DESC
  FOR XML AUTO,BINARY BASE64
  fan hui jie guo :
  cha xun yu ju :
  SELECT CategoryID,
  Picture
  FROM Categories
  WHERE CategoryID =1
  ORDER BY CategoryID DESC
  FOR XML AUTO,ELEMENTS,BINARY BASE64
  fan hui jie guo :
  1
  FRwvAAIAAAANAA4AFAAhAP////9CaXRt...【原文】【汉音对照
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
you yu XML ben shen de zhu duo you dian ,XML ji shu yi bei guang fan de shi yong , mu qian de hao duo ruan jian ji shu tong XML jin mi xiang guan , bi ru wei ruan de .net ping tai dui xml ti gong le qiang da de zhi chi , ti gong System.Xml yi ji qi zi ming ming kong jian xia de lei xing lai cao zuo xml。Ado.net tong guo gai xin lei xing DataSet chu se de ba guan xi xing shu ju ku tong xml jin xing le jin mi ji cheng 。 you yu ping chang xu duo kai fa ren yuan shi yong .net lai cao zuo SQL Server de dao shu ju ji hou zai zhuan huan cheng xml, suo yi wang wang hu lue Transact-SQL cha xun sheng cheng XML shu ju de qiang da gong neng 。 dui yu yi xie xiang mu shi yong XML cha xun zhi jie tong guo SQL sheng cheng xml hui lai de geng wei jian bian , suo yi wo tong guo zai shi ji xiang mu zhong de shi yong he cha yue yi xie zi liao xie cheng yi ge zhi shi dian , yi shi wen gu er zhi xin , er shi dui yu yi xie kai fa zhe gang hao xu yao zhe fang mian de ji shu er huan mei you zhao dao bi jiao kuai jie de xue xi fang shi ti gong yi tiao tu jing 。 zai SQL SERVER 2000 zhong cha xun sheng cheng XML de yu fa biao da shi bi jiao jian jie , zheng ge yu fa ru xia : SELECT FROM WHERE FOR XML AUTO | RAW | EXPLICIT [,XMLDATA ] [,ELEMENTS] [,BINARY BASE64] xia mian wo jiang yi Northwind shu ju ku lai yan shi shang mian de biao da shi zhong suo bao han de ge xiang gong neng , xia mian de cha xun yu ju he fan hui jie guo dou tong guo SQL SERVER 2000 cha xun fen xi qi lai zhi xing he de dao 。 yi . shi yong AUTO mo shi gai mo shi wo ren wei zai sheng cheng dan biao xml shu ju fang mian shi yong de zui duo de , neng man zu yi ban de xu yao 。 xian lai kan ta de jian dan cha xun 。 1. jian dan cha xun cha xun yu ju : SELECT CategoryID, CategoryName FROM Categories WHERE CategoryID < 3 FOR XML AUTO fan hui jie guo : ye ke yi shi yong bie ming , cha xun yu ju : SELECT CategoryID AS ID, CategoryName, GetDate() as CurrDate FROM Categories MyTable WHERE CategoryID < 3 FOR XML AUTO fan hui jie guo : 2. lian jie cha xun yi liang ge biao wei li , cha xun yu ju : SELECT Categories.CategoryID, Categories.CategoryName, ProductID, ProductName FROM Categories JOIN Products ON Categories.CategoryID = Products.CategoryID AND ProductID <5 WHERE Categories.CategoryID < 3 FOR XML AUTO fan hui jie guo : ke yi kan dao biao lian jie cha xun ke yi sheng cheng fen ceng ci de Xml, bu guo xu yao zhu yi de shi SELECT zi ju zhong de fu biao de lie yao pai zai zi biao de lie de qian mian , fou ze hui chu xian ni bu xiang kan dao de jie guo , ru : cha xun yu ju : SELECT ProductID,Categories.CategoryID,Categories.CategoryName,ProductName FROM Categories JOIN Products ON Categories.CategoryID = Products.CategoryID and ProductID <5 WHERE Categories.CategoryID <3 FOR XML AUTO fan hui jie guo : 3. shi yong ELEMENTS xuan xiang shi yong gai xuan xiang ke yi sheng cheng yi yuan su wei zhong xin de Xml biao shi , mo ren wei shu xing fang shi , bu guo shu xing fang shi jie sheng kong jian 。 xu yao zhu yi de shi shi yong ELEMENTS xuan xiang shi yi zhong quan shi huo quan fou de xing shi , bu neng de dao yi bu fen shi yi yuan su biao shi er ling yi bu fen yi shu xing biao shi de Xml shu ju 。 cha xun yu ju : SELECT CategoryID, CategoryName FROM Categories WHERE CategoryID < 3 FOR XML AUTO, ELEMENTS fan hui jie guo : 1 Beverages 2 Condiments zai lian jie cha xun shi , cha xun yu ju : SELECT Categories.CategoryID, ProductID, ProductName FROM Categories JOIN Products ON Categories.CategoryID = Products.CategoryID and ProductID <4 WHERE Categories.CategoryID <3 FOR XML AUTO, ELEMENTS fan hui jie guo : 1 1 Chai 2 Chang 2 3 Aniseed Syrup 4. jian suo dui er jin zhi shu ju de XPath yin yong zhe shi dui er jin zhi shu ju de cao zuo , cha xun yu ju : SELECT CategoryID, Picture FROM Categories WHERE CategoryID = 1 FOR XML AUTO fan hui jie guo : shi yong ELEMENTS fang shi , cha xun yu ju : SELECT CategoryID, Picture FROM Categories WHERE CategoryID = 1 FOR XML AUTO,ELEMENTS fan hui jie guo : 1 dbobject/Categories[@CategoryID='1']/@Picture er . shi yong RAW mo shi shi yong RAW mo shi bu neng shi yong ELEMENTS xuan xiang 。 1. jian dan cha xun cha xun yu ju : SELECT CategoryID, CategoryName AS Nanme FROM Categories WHERE CategoryID < 3 ORDER BY CategoryID DESC FOR XML RAW fan hui jie guo : 2. lian jie cha xun cha xun yu ju : SELECT Categories.CategoryID, Categories.CategoryName, ProductID, ProductName FROM Categories JOIN Products ON Categories.CategoryID = Products.CategoryID and ProductID <4 WHERE Categories.CategoryID <= 2 FOR XML RAW fan hui jie guo : san . shi yong EXPLICIT mo shi gai mo shi shi yong qi lai xiang dui bi jiao fu duo , bu guo ta ke yi hen ling huo de kong zhi fan hui de xml shu ju jie gou 。 zai gai cha xun zhong ding yi le liang ge biao shi yuan shu ju de e wai lie 。Tag lie wei yi de que ding yong lai zai jie guo zhong biao shi mei yi xing de xml biao ji ,Parent lie yong lai kong zhi yuan su zhi jian de qian tao guan xi 。 1. shi yong tong yong biao EXPLICIT mo shi xia you yi ge tong yong biao de gai nian , shi yong shu ju lie de ming cheng lai ding yi xml wen dang zhong de shu ju 。 jie gou ru xia : ElementName!TagNumber!AttributeName!Directive xia mian de shuo ming lai zi lian ji cong shu , ElementName shi suo de dao de yuan su lei shu biao shi fu ( li ru , ru guo jiang Customers zhi ding wei ElementName, ze shi yuan su biao ji )。 TagNumber shi yuan su de biao ji hao 。 jie zhu yu tong yong biao zhong de liang ge yuan shu ju lie (Tag he Parent),TagNumber yong yu biao shi XML shu zhong de XML yuan su qian tao 。 mei ge TagNumber dou zhun que dui ying yu yi ge ElementName。 AttributeName shi XML te xing de ming cheng ( ru guo mei you zhi ding Directive) huo bao han de yuan su ming ( ru guo Directive shi xml、cdata huo element)。 ru guo zhi ding Directive, ze AttributeName ke yi wei kong 。 zhe zhong qing kuang xia , lie zhong bao han de zhi zhi jie you ju you zhi ding ElementName de yuan su suo bao han 。 Directive shi ke xuan ming ling 。 ru guo mei you zhi ding Directive, ze bi xu zhi ding AttributeName。 ru guo mei you zhi ding AttributeName qie mei you zhi ding Directive( ru Customer!1), ze biao shi yuan su ming ling ( ru Customer!1!!element) qie bao han shu ju 。 Directive you liang zhong yong tu 。 gai xuan xiang yong yu fen bie shi yong guan jian zi ID、IDREF he IDREFS dui ID、IDREF he IDREFS jin xing bian ma 。 huan yong yu biao shi ru he shi yong guan jian zi hide、element、xml、xmltext he cdata jiang zi fu chuan shu ju yang she dao XML。 da duo shu qing kuang xia yuan xu zai zhe xie zu zhong zu he zhi ling , dan shi bu neng zai zu ben shen zhong jin xing zu he 。 ID ke jiang yuan su te xing zhi ding wei ID lei xing de te xing 。 ran hou ke yi shi yong IDREF he IDREFS te xing yin yong ta men , yi qi yong wen dang nei de lian jie 。 dan shi , ru guo mei you qing qiu XMLDATA, ze ci guan jian zi wu xiao 。 IDREF zhi ding wei IDREF de te xing ke yong yu yin yong ID lei xing de te xing , yi qi yong wen dang nei de lian jie 。 dan shi , ru guo mei you qing qiu XMLDATA, ze ci guan jian zi wu xiao 。 IDREFS zhi ding wei IDREFS de te xing ke yong yu yin yong ID lei xing de te xing , yi qi yong wen dang nei de lian jie 。 dan shi , ru guo mei you qing qiu XMLDATA, ze ci guan jian zi wu xiao 。 hide bu xian shi te xing 。 zhe dui yu an zhao bu chu xian zai jie guo zhong de te xing dui jie guo jin xing pai xu ke neng hen you yong 。 element bu sheng cheng te xing 。 er shi sheng cheng ju you zhi ding ming cheng de bao han yuan su ( ru guo mei you zhi ding te xing ming ze zhi jie sheng cheng bao han yuan su )。 bao han shu ju bei bian ma wei shi ti ( li ru , zi fu < bian cheng <)。 gai guan jian zi ke yi yu ID、IDREF huo IDREFS zu he 。 xml chu le bu jin xing shi ti bian ma wai , gai ming ling yu yuan su ming ling xiang tong ( li ru , zi fu < reng shi <)。 chu le hide wai , gai ming ling bu neng yu ren he qi ta ming ling yi qi shi yong 。 xmltext lie nei rong ying bao zai dan ge biao ji nei , yi bian yu wen dang de qi ta bu fen ji cheng 。 ru guo zhi ding le AttributeName, ze biao ji ming you zhi ding ming cheng ti huan ; fou ze tong guo jiang nei rong fang zai rong qi de qi shi chu er bu jin xing shi ti bian ma , jiang te xing zhui jia dao bao han yuan su de dang qian te xing lie biao 。 han you gai ming ling de lie bi xu shi wen ben lei xing (varchar、nvarchar、char、nchar、text、ntext)。 gai ming ling zhi neng yu hide yi qi shi yong 。 zai ti qu cun chu zai lie zhong de yi chu shu ju shi gai ming ling hen you yong 。 ru guo nei rong bu shi you xiao de XML, ze gai xing wei bu ming que 。 cdata tong guo yong CDATA jie huan rao shu ju lai bao han shu ju 。 bu dui nei rong jin xing shi ti bian ma 。 yuan shi shu ju lei xing bi xu shi wen ben lei xing (varchar、nvarchar、text、ntext)。 gai ming ling zhi neng yu hide yi qi shi yong 。 dang shi yong gai ming ling shi , bu ying zhi ding AttributeName。 2. jian dan cha xun zai zhi ding shu ju suo zai de yuan su de ming cheng he biao ji shi bi xu shi yong ElementName shen shu he Tag shen shu , ye jiu shi cha xun yu ju zhong biao zhong cun zai de mei yi ge shi ji de shu ju lie dou bi xu yi ElementName!Tag kai tou 。 zai mei you zhi ding AttributeName!Directive de qing kuang xia yi yuan su zhi de xing shi fan hui 。 zai zhi cha xun yi ge biao de qing kuang xia Tag wei 1,Parent wei NULL。 shi yong EXPLICIT mo shi lai cha xun shu ju wo ren wei shi yong dao tui de fang shi hui bi jiao fang bian yi xie , bi ru wo yao de dao ru xia jie gou , Description cha xun yu ju : SELECT 1 AS Tag,NULL AS Parent, CategoryID AS [Category!1!ID], CategoryName AS [Category!1!Name], Description AS [Category!1] FROM Categories WHERE categoryID > 6 FOR XML EXPLICIT fan hui jie guo : Dried fruit and bean curd Seaweed and fish dang ran xia mian de yu ju tong shang mian de deng xiao , SELECT 1 Tag,NULL Parent, CategoryID [Category!1!ID], CategoryName [Category!1!Name], Description [Category!1] FROM Categories WHERE categoryID > 6 FOR XML EXPLICIT 2. lian jie cha xun zai EXPLICIT mo shi xia de duo biao lian jie cha xun ke neng xiang dui bi jiao fu duo xie , xian lai kan yi ge jian dan de li zi , cha xun yu ju : SELECT 1 AS Tag,NULL AS Parent, Categories.CategoryID AS [Category!1!ID], Categories.CategoryName AS [Category!1!!element], ProductID AS [Category!1!ProductID!element], ProductName AS [Category!1!ProductName!element] FROM Categories JOIN Products ON Categories.CategoryID = Products.CategoryID AND ProductID <5 WHERE Categories.CategoryID < 3 FOR XML EXPLICIT fan hui jie guo : Beverages 1 Chai Beverages 2 Chang Condiments 3 Aniseed Syrup Condiments 4 Chef Anton&apos;s Cajun Seasoning cong shang mian de jie gou ke yi kan chu shu ju de xml jie gou bu shi hen shu fu , cun zai bi jiao da de rong yu 。 xiang xiang zhong gai jin hou de jie gou ru xia : 3 Aniseed Syrup 4 Chef Anton&apos;s Cajun Seasoning 1 Chai 2 Chang cong shang mian kan chu Category yuan su de Tag wei 1,Parent wei NULL, er Product yuan su de Tag wei 2,Parent wei 1( ji Category de Tag zhi )。 zhe li you yi ge wen ti xu yao jie jue , na jiu shi zai Tag he Parent zhong cun zai liang tao zhi , zhe li jiu xu yao shi yong UNION ALL yun suan fu lai shi xian zhe xiang gong neng ,UNION ALL yun suan fu de yi xiang gong neng jiu shi xiao chu cha xun fan hui de chong fu de xing 。 shi yong UNION ALL shi xu yao zhu yi de shi jie guo ji de lie shu bi xu xiang tong 。 cha xun yu ju : SELECT 1 AS Tag,NULL AS Parent, CategoryID AS [Category!1!ID], CategoryName AS [Category!1!Name], NULL AS [Product!2!ProductID!element], NULL AS [Product!2!ProductName!element] FROM Categories WHERE CategoryID < 3 UNION ALL SELECT 2 AS Tag,1 AS Parent, Categories.CategoryID AS [Category!1!ID], Categories.CategoryName AS [Category!1!Name],-- zhe li ke yi shi yong NULL dai ti ProductID AS [Product!2!ProductID!element], ProductName AS [Product!2!ProductName!element] FROM Categories JOIN Products ON Categories.CategoryID = Products.CategoryID AND ProductID <5 WHERE Categories.CategoryID < 3 ORDER BY [Category!1!ID] DESC,[Product!2!ProductID!element] ASC FOR XML EXPLICIT fan hui jie guo : 3 Aniseed Syrup 4 Chef Anton&apos;s Cajun Seasoning 1 Chai 2 Chang bu dai FOR XML EXPLICIT yu ju de jie guo wei : Tag Parent Category!1! ID Category!1!Name Product!2! Product!2! ProductID!element ProductName!element ---- ------- ---------- ------------ -------------------------- ---------------------------- 1 NULL 2 Condiments NULL NULL 2 1 2 Condiments 3 Aniseed Syrup 2 1 2 Condiments 4 Chef Anton's Cajun Seasoning 1 NULL 1 Beverages NULL NULL 2 1 1 Beverages 1 Chai 2 1 1 Beverages 2 Chang 3. shi yong EXPLICIT mo shi cha xun zhong de zhi ling zhe xie zhi ling shi zhi tong yong biao lie de di si bu fen , tong guo ta dui shu ju jin xing jin yi bu kong zhi 。 1> zui chang yong de element he xml zhi ling tong guo gai zhi ling ba lie de shu ju xian shi wei yi ge zi yuan su er bu shi shu xing 。 cha xun yu ju : SELECT 1 AS Tag,NULL AS Parent, CategoryID AS [Category!1!ID], CategoryName [Category!1!Name], Description [Category!1!!element] FROM Categories WHERE categoryID > 6 FOR XML EXPLICIT fan hui jie guo : Dried fruit and bean curd Seaweed and fish cha xun yu ju : SELECT 1 AS Tag,NULL AS Parent, CategoryID AS [Category!1!ID], CategoryName [Category!1!Name], Description [Category!1!Description!element] FROM Categories WHERE categoryID > 6 FOR XML EXPLICIT fan hui jie guo : Dried fruit and bean curd Seaweed and fish cha xun yu ju : SELECT 1 AS Tag,NULL AS Parent, CategoryID AS [Category!1!ID], CategoryName [Category!1], Description [Category!1!Description!element] FROM Categories WHERE categoryID > 6 FOR XML EXPLICIT fan hui jie guo : Produce Dried fruit and bean curd Seafood Seaweed and fish xml zhi ling tong element zhi ling cha bu duo , zhi shi element zhi ling hui jiang yi xie xml xia mian de fu hao jin xing bian ma , ru > bei bian ma cheng >5, er xml zhi ling bu hui 。 2> shi yong hide zhi ling gai zhi ling shi yong lai chu li na xie bu xiang fan hui jie guo de lie , xu duo ren hui you yi wen jiao de mei you bi yao , zhi yao zai lie zhong bu zeng jia jiu xing le , tiao jian he pai xu ye ke yi zhi jie shi yong lie 。 wo men ke yi xiang de dao shi yong UNION ALL shi jiu yong de shang le , kan xia mian de li zi 。 cha xun yu ju : SELECT 1 AS Tag,NULL AS Parent, CategoryID AS [Category!1!ID!hide], CategoryName AS [Category!1!Name], NULL AS [Product!2!ProductID!element], NULL AS [Product!2!ProductName!element] FROM Categories WHERE CategoryID < 3 UNION ALL SELECT 2 ,1 , Categories.CategoryID, NULL, ProductID, ProductName FROM Categories JOIN Products ON Categories.CategoryID = Products.CategoryID AND ProductID <5 WHERE Categories.CategoryID < 3 ORDER BY [Category!1!ID!hide] DESC,[Product!2!ProductID!element] ASC FOR XML EXPLICIT fan hui jie guo : 3 Aniseed Syrup 4 Chef Anton&apos;s Cajun Seasoning 1 Chai 2 Chang 3> shi yong xmltext zhi ling gai zhi ling shi yong lai chu li bao han xml pian duan nei rong de shu ju lie , mei zhao dao xian cheng de biao jie gou he shu ju jin xing ce shi , suo yi jiu zai Categories biao zhong zeng jia le XmlData lie ming , lei xing wei nvarchar, mo ren zhi she zhi wei “”。 cha xun yu ju : SELECT 1 AS Tag,NULL AS Parent, CategoryID AS [Category!1!ID], XmlData AS [Category!1!CustomData!xmltext] FROM Categories WHERE CategoryID = 8 FOR XML EXPLICIT fan hui jie guo : cha xun yu ju : SELECT 1 AS Tag,NULL AS Parent, CategoryID AS [Category!1!ID], XmlData AS [Category!1!!xmltext] FROM Categories WHERE categoryID = 8 FOR XML EXPLICIT fan hui jie guo : 4> shi yong cdata zhi ling shi yong gai zhi ling ke yi chuang jian CDATA jie fang zhi yi xie zi fu shu ju bei xml jie xi qi 。 cha xun yu ju : SELECT 1 AS Tag,NULL AS Parent, CategoryID AS [Category!1!ID], XmlData AS [Category!1!!cdata] FROM Categories WHERE categoryID = 6 FOR XML EXPLICIT fan hui jie guo : ]]> 5> shi yong ID、IDREF he IDREFS zhi ling yi ji XMLDATA xuan xiang you yu zhe li zhi neng fan hui XDR gou jia , bu zhi chi XSD jia gou de jian suo , wo jiu zhi gei chu yi ge li zi , cha xun yu ju : SELECT 1 AS Tag,NULL AS Parent, CategoryID AS [Category!1!ID!ID], CategoryName AS [Category!1!Name], NULL AS [Product!2!ProductID!IDREF], NULL AS [Product!2!ProductName] FROM Categories WHERE CategoryID < 3 UNION ALL SELECT 2 ,1 , Categories.CategoryID, NULL, ProductID, ProductName FROM Categories JOIN Products ON Categories.CategoryID = Products.CategoryID AND ProductID <5 WHERE Categories.CategoryID < 3 ORDER BY [Category!1!ID!ID] ,[Product!2!ProductID!IDREF] FOR XML EXPLICIT,XMLDATA fan hui jie guo : si . shi yong BINARY BASE64 xuan xiang shi yong gai xuan xiang ke yi jian suo er jin zhi zi duan , bi ru tu xiang shu ju yi base64 de xing shi fan hui dao xml wen dang 。 1. shi yong RAW fang shi cha xun yu ju : SELECT CategoryID, Picture FROM Categories WHERE CategoryID =1 ORDER BY CategoryID DESC FOR XML RAW,BINARY BASE64 fan hui jie guo : 2. shi yong AUTO fang shi cha xun yu ju : SELECT CategoryID, Picture FROM Categories WHERE CategoryID =2 ORDER BY CategoryID DESC FOR XML AUTO,BINARY BASE64 fan hui jie guo : cha xun yu ju : SELECT CategoryID, Picture FROM Categories WHERE CategoryID =1 ORDER BY CategoryID DESC FOR XML AUTO,ELEMENTS,BINARY BASE64 fan hui jie guo : 1 FRwvAAIAAAANAA4AFAAhAP////9CaXRt...
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
时尚性感的燕子(3)
时尚性感的燕子(2)
纯美的女生生活写真(14)
纯美的女生生活写真(13)
来自束河[]
恰巧-巧家~~
高尔夫
行摄匆匆天子山
 
>>返回首页<<
 为你推荐
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
©2005- 王朝网络 版权所有