您好我只想将xml变量插入到xml代码中。
我的代码如下:
DECLARE @outMsg xml
SET @outMsg='<jbpmEngineSignal>
<type>WORK_ITEM_COMPLETE</type>
<elementId>257976516</elementId>
<priority>0</priority>
<results />
<tryCount>344</tryCount>
<uid>7028D745-1C62-46C3-9543-6C1D233450C8</uid>
</jbpmEngineSignal>';
现在我只需要这样做:
DECLARE @UID xml
set @UID = '7028D745-1C62-46C3-9543-6C1D233450C8'
最后
DECLARE @outMsg xml
DECLARE @UID xml
set @UID = '7028D745-1C62-46C3-9543-6C1D233450C8'
SET @outMsg='<jbpmEngineSignal>
<type>WORK_ITEM_COMPLETE</type>
<elementId>257976516</elementId>
<priority>0</priority>
<results />
<tryCount>344</tryCount>
<uid>@UID</uid>
</jbpmEngineSignal>';
但这不起作用,我做错了什么?有人可以编辑我的代码并告诉我如何做到这一点? 谢谢。请耐心等待新手。当您需要更多信息时,请在评论中写下:)
答案 0 :(得分:1)
您为什么不使用nvarchar作为UID?然后你可以这样简单:
DECLARE @outMsg xml
DECLARE @UID nvarchar(1000);
set @UID = '7028D745-1C62-46C3-9543-6C1D233450C8'
SET @outMsg='<jbpmEngineSignal>
<type>WORK_ITEM_COMPLETE</type>
<elementId>257976516</elementId>
<priority>0</priority>
<results />
<tryCount>344</tryCount>
<uid>' + @UID + '</uid>
</jbpmEngineSignal>';