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

SQL XML DELETE

--A. ´Ó´æ´¢ÔÚ·ÇÀàÐÍ»¯µÄ xml ±äÁ¿ÖеÄÎĵµÖÐɾ³ý½Úµã
DECLARE @myDoc xml
SET @myDoc = '<?Instructions for=TheWC.exe ?>
<Root>
 <!-- instructions for the 1st work center -->
<Location LocationID="10" LaborHours="1.1" MachineHours=".2" >
 Some text 1
 <step>Manufacturing step 1 at this work center</step>
 <step>Manufacturing step 2 at this work center</step>
</Location>
</Root>'
SELECT @myDoc
-- delete an attribute
SET @myDoc.modify('
  delete /Root/Location/@MachineHours
')
SELECT @myDoc
-- delete an element
SET @myDoc.modify('
  delete /Root/Location/step[2]
')
SELECT @myDoc
-- delete text node (in <Location>
SET @myDoc.modify('
  delete /Root/Location/text()
')
SELECT @myDoc
-- delete all processing instructions
SET @myDoc.modify('
  delete //processing-instruction()
')
SELECT @myDoc
--B. ´Ó´æ´¢ÔÚ·ÇÀàÐÍ»¯µÄ xml ÁÐÖеÄÎĵµÖÐɾ³ý½Úµã
delete XML DML Óï¾ä´Ó´æ´¢ÔÚÁÐÖеÄÎĵµÖÐɾ³ý <Features> µÄµÚ¶þ¸ö×ÓÔªËØ¡£
CREATE TABLE #T (i int, x xml)
go
INSERT INTO #T VALUES(1,'<Root>
<ProductDescription ProductID="1" ProductName="Road Bike">
 <Features>
   <Warranty>1 year parts and labor</Warranty>
   <Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
 </Features>
</ProductDescription>
</Root>')
go
-- verify the contents before delete£¬query·µ»ØFeaturesÔªËØÏµÄËùÓнڵã,ÒÔXML¸ñʽ·µ»Ø
SELECT x.query('//ProductDescription/Features')
from #T
-- delete the second feature
UPDATE #T
SET x.modify('delete /Root/ProductDescription/Features/*[2]')
-- verify the deletion
SELECT x.query(' //ProductDescription/Features')
from #T
DROP TABLE #T
C. ´Ó·ÇÀàÐÍ»¯µÄ xml ÁÐÖÐɾ³ý½Úµã
create table #T(ProductModelID int primary key,
Instructions xml )
go
insert  #T
select ProductModelID, Instructions
from Prod


Ïà¹ØÎĵµ£º

js ½âÎö xml ÊôÐÔ

function init() {
 var viewChartID = 0;
 var viewChartSum = "" ;
 reportName = document.getElementById("reportName").value;
 xmlDoc=loadXMLDoc("./charreport/xml/viewChart.xml");
 x=xmlDoc.getElementsByTagName('viewChart')[0].childNodes;
 for (i=0;i<x.length;i++ ......

SQLÖÐCONVERTת»¯º¯ÊýµÄÓ÷¨

Õª×Ô£ºhttp://www.cnblogs.com/dicky/archive/2007/01/12/618453.html
¸ñʽ:
CONVERT(data_type,expression[,style])
˵Ã÷:
´ËÑùʽһ°ãÔÚʱ¼äÀàÐÍ(datetime,smalldatetime)Óë×Ö·û´®ÀàÐÍ(nchar,nvarchar,char,varchar)
Ï໥ת»»µÄʱºò²ÅÓõ½.
Àý×Ó:
SELECT CONVERT(varchar(30),getdate(),101) now
½á¹ûΪ ......

XML Schema£¨Ó¦ÓÃÉè¼Æ£©

     XML SchemaÖ÷ÒªÓÃÀ´Éè¼ÆXMLÎĵµµÄ½á¹¹£¬×¢Òâ²»ÊǸñʽ¡£ÓÐÈËÎÊÔõô²»ÊǸñʽ£¿¸ñʽ¸ú½á¹¹Ê²Ã´Çø±ð£¿ÎÒÏë¸ã¿ª·¢µÄÈ˶¼¶Ô´úÂë½øÐиñʽ»¯¹ý£¬Ò²¾ÍÊÇËõ½ø¡¢×ÖÌåµÈµÈ£»¶øÎÒÃÇдµÄ³ÌÐòʵ¼ÊÉÏÒ²ÊǶ¨ÒåÒ»Öֽṹ£¬Ëü²»»áÒòΪÄãÊÇ·ñËõ½ø¡¢²ÉÓò»Í¬µÄ×ÖÌå¾ÍÓÐËù¸Ä±ä°É£¿ºÜ¶àÈËÄÄÁ˲»·ÖÐеÄxmlÎĵµËµÓÃVSµÄ¹¤¾ß¸ ......

SQL ÃüÁ½õ

Õⲿ·Ö°üº¬ÄÇЩ PostgreSQL Ö§³ÖµÄ SQL ÃüÁîµÄÐÅÏ¢£®ÕâÀïµÄ "SQL" ¾ÍÊǸÃÓïÑÔͨ³£
µÄº¬Ò壻 ÿÌõÃüÁîµÄÓë±ê×¼ÓйصļæÈÝÐÔµÄÐÅÏ¢¿ÉÒÔÔÚÏà¹ØµÄ²Î¿¼Ò³ÖÐÕÒµ½£®
Table of Contents
ABORT --  Í˳öµ±Ç°ÊÂÎñ
ALTER GROUP --  Ïò×éÖÐÔö¼ÓÓû§»ò´Ó×éÖÐɾ³ýÓû§ 
ALTER USER --  ¸Ä±äÊý¾Ý¿âÓû§Õʺţ®
......

[ת]Éú³ÉÎÞ¼¶Ê÷(sqlº¯Êý)

--´¦ÀíʾÀý
--ʾÀýÊý¾Ý
create table tb(ID int,Name varchar(10),ParentID int)
insert tb select 1,'AAAA'    ,0
union all select 2,'BBBB'    ,0
union all select 3,'CCCC'    ,0
union all select 4,'AAAA-1'  ,1
union all select 5,'AAAA-2'  ,1
u ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ