ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Char(13) displaying as square in Excel (https://www.excelbanter.com/excel-programming/369924-char-13-displaying-square-excel.html)

LESLIE

Char(13) displaying as square in Excel
 
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.



Jake Marx[_3_]

Char(13) displaying as square in Excel
 
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]

Leslie wrote:
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.





All times are GMT +1. The time now is 01:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com