我有这个代码:
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. <br />Please view the attachment for our latest communication to you.', ''+@message+'');
end
end
我正在从 bdParameters 表中选择一个主体。正文包含类似的值
<BOLD>Hello!</BOLD>
但函数替换后,值变为<BOLD>Hello!</BOLD>
我希望它停止这样做。我希望值保持编码。如何?