xml 形式的参数 修改存储过程的创建

来源:互联网 发布:mac不能拷贝文件到u盘 编辑:程序博客网 时间:2024/06/05 01:52

create  procedure [dbo].[FirstPayedDatailSave]
@Input varchar(max)
as
begin


 SET NOCOUNT ON;   
 DECLARE @x XML, @ID VARCHAR(20);
 SET @x = @Input; 
with ae as
(
 SELECT
     x.item.value('@ID[1]', 'VARCHAR(20)') AS ID,      
  x.item.value('ActuallyPayed[1]', 'decimal(18, 2)') AS ActuallyPayed,
  --convert(datetime ,x.item.value('GetPayedDate[1]', 'Datetime'),120) AS GetPayedDate,
  getdate() as  GetPayedDate,
  x.item.value('Receipt[1]','varchar(50)') as Receipt,
  x.item.value('IsPayed[1]','varchar(50)') as IsPayed,
  x.item.value('Authenticated[1]','varchar(50)') as Authenticated,
  x.item.value('PayedType[1]','varchar(50)') as PayedType,
  x.item.value('Remark[1]','varchar(100)') as Remark
 FROM @x.nodes('//FirstPayed') AS x(item)
)
update FirstPayed set 
 ActuallyPayed=x.ActuallyPayed,
 GetPayedDate=x.GetPayedDate,
 Receipt=x.Receipt,
 IsPayed=x.IsPayed,
 Authenticated=x.Authenticated,
 PayedType=x.PayedType,
 Remark=x.Remark 
from FirstPayed as a ,ae as x where a.ID=x.ID
end

原创粉丝点击