易截截图软件、单文件、免安装、纯绿色、仅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++ ......

通过DOM4J解析XML文件小结

创建XML文件:
public boolean createXML(){
  try{
   Document doc = DocumentHelper.createDocument();
   Element root = doc.addElement("root");
   Element personNode = root.addElement("person");
   Element sonNode = personNode ......

从【各大软件公司笔试压轴题】学习SQL语句

从博客园中看到一篇文章,介绍大软件公司面试时常常会出的两道SQL题(见附录)。
我觉得受益很多,在此之前,我一直觉得,SQL2008似乎提供了这方面的支持,但更低的版本,包括2005,非游标做不出来(水平够菜)。总结心得如下:
1、    强大的group by
1
 select stdname,
2
 isnull(s ......

[转]生成无级树(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 ......

怎么把 sql语句查询的值赋给变量

string str = System.Configuration.ConfigurationManager.AppSettings["strconn"];
string sqlpwd = "select password from bg_user where username='" + username + "'";
MySqlConnection conn = new MySqlConnection(str);
MySqlCommand cmd=new MySqlCommand(sqlpwd,conn);
MySqlDataAdapter adr = new MySqlDataA ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号