1

私はこのコードを持っています:

DECLARE @body nvarchar(max)

    DECLARE @Query nvarchar(max)
    SET @Query = 'SELECT TOP 1 @body = sbdp.bdParameters from P'+@InternalEntityID+'..SchedulerBatchDetailParameters sbdp with(NoLock) WHERE sbdp.fileID=@FileID'

    DECLARE @result as nvarchar(max)
    exec sp_executesql @Query, N'@body varchar(max) output, @FileID as Int', @FileID = @FileID, @body = @result output


--Set bdParameters to XML
    DECLARE @xmltemp xml
    DECLARE @message nvarchar(max)
    SELECT @xmltemp = @result

--Set @message to attribute @emailMsg
    SELECT @message = a.b.value('@emailMsg', 'nvarchar(max)')
    FROM @xmltemp.nodes('/root/row') as a(b)



if @message is not null 
    begin
        if @message <> ''
        begin
            set @EmailBodyTemplate = replace(@EmailBodyTemplate, 'You are receiving this notification because you have agreed to receive specific community and account notifications via e-mail. &lt;br /&gt;Please view the attachment for our latest communication to you.', ''+@message+''); 
        end
    end 

bdParameters テーブルからボディを選択しています。ボディには次のような値が含まれています

&lt;BOLD&gt;Hello!&lt;/BOLD&gt; しかし、関数の置換後、値は次のようになります<BOLD>Hello!</BOLD>

そういうのやめてほしい。値をエンコードしたままにしたい。どのように?

4

0 に答える 0