Char(13) displaying as square in Excel

G

Guest

We are using Excel to load data into SQL.

We are using the Concatenate function to join a couple columns of data and
we want to put a CRLF (Carriage Return, Line Feed) after the first column
(line) of data.

=IF(B2=F2,A2,CONCATENATE(A2, CHAR(10), B2) )

This data will be loaded into a nvarchar field (notes) in SQL. I know about
using the 'wrap text' formatting to get rid of the square box display in
Excel and display the text as two lines. However, when we import this data
into the SQL database, the square box is what is displayed, and the data is
not being put on two separate lines.

Anyone ever encountered this problem and have any solutions?

Thanks,
Leslie Fournier
Oregon Aero, Inc.
 
J

Jake Marx

Hi Leslie,

Your subject line indicates CHAR(13), and your message indicates CHAR(10).
For vbCrLf, you need both (13 first, then 10):

=IF(B2=F2,A2,CONCATENATE(A2, CHAR(13) & CHAR(10), B2) )

Does that work as expected?

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top