Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Backslash

Author  Topic 

djurden
Starting Member

2 Posts

Posted - 2010-10-27 : 17:29:43
I am trying to insert some data into a SQL Server table. One of the columns is a VARCHAR column with the possiblity of having some carriage return and line feed characters. The problem is that on a line that ends with a backslash followed by the carriage return and line feed characters, the backslash is being truncated. How can I preserve the backslash character?

Here is a sample. Note the "crlf" characters are the actual carriage return and line feed, not acutal "c" "r" "l" "f" characters.

Source:
This is a test\crlf
This is the second line.


The actual data after insert:
This is a test
This is the second line.

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2010-10-27 : 17:45:18
Can you give more detail? How is it being inserted?

I ran a sample test and I'm gettig a different behavior. But, maybe my test is not valid?:
DECLARE @T TABLE (VAL VARCHAR(50))

INSERT @T
SELECT 'This is a test\' + CHAR(13) + CHAR(10) + 'This is the second line.'


SELECT *
FROM @T
Go to Top of Page

djurden
Starting Member

2 Posts

Posted - 2010-10-27 : 17:47:41
Yea, that works for me also. But the insert command is being generated from FoxPro and sent via SQL Passthrough.
Go to Top of Page
   

- Advertisement -