I have the following query to pull LOB field (HL_DELETED_RECORD which contains no more than 25 characters) content, and it works fine by itself:
SELECT REPLACE(REPLACE( CONVERT(VARCHAR(20), HL_DELETED_RECORD), '&', '&'), 'ý', ' ') AS FAC_CHANGES,
HL_REC_ID
FROM SEC_HIST WITH(NOLOCK)
When I include this query as part of a CTE there are no errors; the LOB text data does not display at all as:
WITH sec_audit AS
(
SELECT *...
),
hist_logs as
(
SELECT REPLACE(REPLACE( CONVERT(VARCHAR(20), HL_DELETED_RECORD), '&', '&'), 'ý', ' ') AS FAC_CHANGES,
HL_REC_ID
FROM SEC_HIST WITH(NOLOCK)
)
SELECT *
FROM sec_audit
INNER JOIN hist_logs WITH(NOLOCK) ON HL_REC_ID = HL_RECORD_ID
The LOB column is defined as: [HL_DELETED_RECORD] text NULL
And here's an HL_DELETED_RECORD data sample: 36371ý1025074ýLEC Which is converted as follows: 36371 1025074 LEC
Anyone else experience this? Thanks!