Tag Archives: SQL

CLRF in SQL Server

An interesting problem I was facing was adding CLRF on a string in SQL Server. The solution was to add a combination of chars ( CHAR(13) + CHAR(10) ) where the string should break the line. The follwing example will add CLRF in the string being updated.

UPDATE NM196 SET 
        OSNOVANIE = 
	'Вал. превод Реф.@@500' + CHAR(13) + CHAR(10) + 
	'сума @@547 @@502 @@542' + CHAR(13) + CHAR(10) + 
	'ориг.сума @@501' + CHAR(13) + CHAR(10) + 
	'вальор @@505 ' + CHAR(13) + CHAR(10) + 
	'Наредител: @@522 ' + CHAR(13) + CHAR(10) + 
	'Бенефициент: @@526 ' + CHAR(13) + CHAR(10) + 
	'Основание: @@535 @@546'
WHERE CODE = 295 AND NOMID = 196