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
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
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 Óï¾ä£¬ORACLE ±ØÐë·ÖÅäһƬ½ÐÉÏÏÂÎÄ( context area )µÄÇøÓòÀ´´¦ÀíËù±ØÐèµÄÐÅÏ¢£¬ÆäÖаüÀ¨Òª´¦ÀíµÄÐеÄÊýÄ¿£¬Ò»¸öÖ¸ÏòÓï¾ä±»·ÖÎöÒÔºóµÄ±íʾÐÎʽµÄÖ¸ÕëÒÔ¼°²éѯµÄ»î¶¯¼¯(active set)¡£
ÓαêÊÇÒ»¸öÖ¸ÏòÉÏÏÂÎĵľä±ú( handle)»òÖ¸Õ롣ͨ¹ýÓα꣬PL/SQL¿ÉÒÔ¿ØÖÆÉÏÏÂÎÄÇøºÍ´¦ÀíÓï¾äʱÉÏÏÂÎÄÇø»á·¢ÉúЩʲôÊÂÇ ......
×î½üÔÚ×öNetConfÏà¹Ø¿ª·¢¹¤×÷£¬ÆäÖкÜÖØÒªµÄÒ»¿éÊÇXML½âÎö£¬ÏîĿҲÐèÒªÖ§³ÖSchema£¬Òò´Ëǰ¶Îʱ¼äÕûÀíÁËSchemaµÄÁ½²¿·Ö±ê×¼£¬Ö»²»¹ýÕûÀíÎĵµÊÇÎÞ·¨´ø³öÀ´µÄ£¬ËùÒÔ¾ÍÔڴ˰ÑSchemaÏà¹ØµÄÄÚÈݼòµ¥½éÉÜÆä±ê×¼Ö®ºó£¬ÒÔÈçºÎÓ¦Óõķ½Ê½¼Ç¼ÏÂÀ´£¬ÒÔ¹©ÒÔºóʹÓÃʱ²Î¿¼¡£ÔÚºóÐøµÄ²¿·Ö£¬ÎÒ» ......
°ÑxmlÍϵ½IEÀï¾ÍÕÒµ½´íÔÚÄÄÀïÁË
ÈçÏ£º
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
ÎĵµµÄ¶¥²ãÎÞЧ¡£´¦Àí×ÊÔ´ 'file:///D:/Tomcat 5.5/webapps/myapp/WEB-INF/web.xml' ʱ³ö´í¡£µÚ 1 ÐУ¬Î»ÖÃ: 44 ......