I need to see a certain substring of a field named RESPONSE_STREAM whose data type is TEXT. The DATALENGTH of RESPONSE_STREAM is 913,948 chars, which is way too long to see on my screen. I need to retrieve the rest of the field starting from the first occurrence of 'FLEKSHER', in order to determine if there's a problem with my data. (It's hard to be more specific than that given the nature of what I'm doing--HIPAA data, etc.)
I've tried selecting that field into a temp table and right-clicking on the field to copy it and paste it into a Word document, but the whole field doesn't get copied.
This is the SQL query that selects the field from the table it resides in to a temp table:
SELECT RESPONSE_STREAM INTO #tmp_foo
FROM CMS_BATCH_RESPONSE
WHERE BATCH_UUID ='5F61FB04-8679-48F2-B747-30C9837C85EC' AND
RESPONSE_TYPE_CODE = 835 AND
RESPONSE_STREAM LIKE '%FLEKSHER%'
Doing this told me there are 918,394 chars in the entire field: select DATALENGTH (RESPONSE_STREAM) from #tmp_foo
I expected the following SELECT to tell me where the string 'FLEKSHER' starts in the TEXT field--but it returned 0:
SELECT CHARINDEX ('FLEKSHER', RESPONSE_STREAM, 1) FROM #tmp_foo
Is there any way I can retrieve a substring from this very long TEXT field?