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
相关文档:
现象:
在使用Microsoft SQL Server 2005时,要创建一个登录名,并为该登录名关联了一个数据库,但是在选择“安全对象”选项时,却出现了如题所示的错误。其他信息显示为:执行Transact-SQL语句或批处理时发生了异常(Microsoft.SqlServer.ConnectionInfo)。无法解决 ......
把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 ......
http://blog.csdn.net/java2000_net/archive/2008/04/05/2252640.aspx
http://sqlserver.chinahtml.com/2006/SQL-mssql11432786154012.shtml
http://www.cnblogs.com/garnai/archive/2007/09/19/898221.html
http://tech.ccidnet.com/art/1099/20050223/214511_1.html
http://www.wangchao.net.cn/bbsdetail_43009.html ......
下列语句部分是Mssql语句,不可以在access中使用。
SQL分类: DDL—数据定义语言(CREATE,ALTER,DROP,DECLARE)
DML—数据操纵语言(SELECT,DELETE,UPDATE,INSERT)
DCL—数据控制语言(GRANT,REVOKE,COMMIT,ROLLBACK)
首先,简要介绍基础语句:
1、说明:创建数据库CREATE ......
下面是指导文档。请跟着一步步的做。就能成功连接上sql server 2008
java中连接sql server 2008的注意事项:
2000,2005的数据库驱动类的写法是:
com.microsoft.jdbc.sqlserver.SQLServerDriver
URL的写法是:假设数据库是news
jdbc:microsoft:sqlserver://localhost:1433;databaseName=news
但是20 ......