Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL Update with Carriage Returns

$
0
0

Hello Spiceheads,

I am trying to adapt a series of SQL update statements to update part descriptions in MS SQL Server. Right now the data is all in an Excel spreadsheet.

Part of my challenge is that I have to convert a very large string to binary. Cool, I've got that part worked out.

The on-going issue that I am having is that many of descriptions are multi-line and I cannot seem to preserve the carriage return in when running the update statement.

Here is my query right now:

UPDATE PART_BINARY SET BITS=CAST('XXXXX' AS VARBINARY(8000)) WHERE PART_ID='YYYYY';

To get the carriage returns, I have tried:

'XX' + char(13) + 'XX' + char(13) + ' X'

'XX' + char(10) + 'XX' + char(10) + ' X'

I've tried combinations of both. However, it does not preserve the carriage returns when I look at the data in my ERP.

Any thoughts or suggestions are appreciated.

...


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>