我的表中有一些数据
当我使用此查询选择该数据时
select TblActionHistories.Comments from TblActionHistories WHERE TblActionHistories.Entity=CAST('Task' AS VARCHAR) AND EntityId=CAST(32 AS VARCHAR)
一切都会好起来的
Task- <b>T1</b> has been added by Swapnil Sharma
Task- <b>T1</b> status changed to <b>In Progress</b> by Swapnil Sharma<br/>
但现在我想要我上面的结果#分隔使用stuff
所以我正在使用这个
SELECT STUFF((SELECT '#' + ISNULL(CAST(TblActionHistories.Comments AS VARCHAR(MAX)),'') FROM TblActionHistories WHERE TblActionHistories.Entity=CAST('Task' AS VARCHAR) AND EntityId=CAST(32 AS VARCHAR) for xml path ('')),1,1,'')
它给了我这个
Task- <b>T1</b> has been added by Swapnil Sharma#Task- <b>T1</b> status changed to <b>In Progress</b> by Swapnil Sharma<br/>
您可以清楚地看到所有特殊字符。< >
像<>分别转换成
请帮我解决这个问题,我希望他们以原始格式出现