关于XML 类型字段的修改
2011-07-28 15:44
281 查看
/****** Object: StoredProcedure [dbo].[Ywcd_UpdateOrderFormState] Script Date: 07/28/2011 15:38:39 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: <Author,,Name> -- Create date: <Create Date,,> -- Description: <Description,,> -- ============================================= ALTER PROCEDURE [dbo].[Ywcd_UpdateOrderFormState] -- Add the parameters for the stored procedure here @OrderFormId int,--订单Id @SupplyOid int,--原文提供机构Id @OrderFormState nvarchar(60)--更新的订单状态 AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; declare @stateId int; declare @xml xml; select @xml=DealRule from Ywcd_OrderFormLog where Id=@OrderFormId set @xml.modify('replace value of (/Root/OrderFormState/text())[1] with sql:variable("@OrderFormState")') select @stateId=Id from Ywcd_OrderFormStateDic where Name=@OrderFormState -- Insert statements for procedure here update Ywcd_OrderFormLog set OrderFormStateId=@stateId,SupplyOid=@SupplyOid, DealTime=GETDATE(), DealRule=@xml where Id=@OrderFormId select DealRule from Ywcd_OrderFormLog where Id=@OrderFormId END
总结:modify方法,更新xml内容用replace
(/Root/OrderFormState/text())[1] 为修改节点内容,而非修改属性值
sql:variable("@OrderFormState") 调用sql变量
相关文章推荐
- table字段是XMLTYPE类型时的修改
- 关于修改DB2数据库中字段类型
- 关于修改表字段数据类型的问题(ORA-22859: 无效的列修改 )
- 关于修改以太网帧头类型字段引发的问题
- 关于jsoncpp读取浮点数类型字段
- mysql数据库中sql修改字段类型
- Mysql中用SQL增加、删除字段,修改字段名、字段类型、注释,调整字段顺序总结
- oralce大表修改字段类型方法
- 关于tomcat server.xml 修改不生效的问题
- 关于sap的字段和对象修改记录的查找
- Oracle/SQL 修改字段类型和长度
- oracle 修改字段类型
- 修改SQL数据库中表字段类型时,报“一个或多个对象访问此列”错误的解决方法
- 修改MySQL中字段的类型和长度
- 批量生成修改数据库表字段类型SQL脚本
- 使用Hibernate4处理Oracle XmlType字段类型
- 关于thrift字段修改的问题
- SQL如何修改被计算字段引用的字段类型
- 关于Blob类型字段的存储和获取
- Oracle修改字段类型方法总结