November 10, 2009 at 2:25 pm
I am using the Wizard to export a table to a tab-delimited text file. The first of six columns is VARCHAR(2000). When I examine the text file, I notice in some cases there are two carriage returns after the first column value. I confirmed that there are no carriage returns in the actual data.
I sensed that the length of the data was an issue so I performed a test on one of the rows that had a problem. I replaced the long value with a much shorter value. Indeed the export was fine for that row. The pair of carriage returns was gone. A test on another such case yielded the same result.
This indicates to me that there is an issue related to the width of the value within the column. This is new to me. Can somebody shed light on this please?
Thanks.
November 11, 2009 at 6:27 am
As another test, I tried exporting with bcp. Same result.
November 11, 2009 at 10:28 am
I figured out the issue. I had line feeds at the end of some values.
The secondary issue is that the manner in which I examined the values did not show the problem. CASE 1: When I found the "faulty" values in a query, I pasted them into my function. The function showed the line feeds as spaces (ASCII 32). CASE 2: However, when I assigned the values to a variable and evaluated the variable, the function showed the line feeds (ASCII 10).
In other words, taking the top snippets of my function...
In CASE 1, I did this...
DECLARE @val VARCHAR(2000)
SET @val = 'A bunch of text ' -- this value pasted from a query
In CASE 2, I did this...
DECLARE @val VARCHAR(2000)
SELECT @val = description FROM test WHERE id = 3095
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply