replace char(13) char(10)

char(13) is carriage return and char(10) is line feed. Different text editors/viewers will interpret it differently.

Use replace function to get all data in 1 line.
replace(replace(replace(column_name,char(13),’ ‘),char(10),’ ‘), char(9), ‘ ‘)

when copying data which have char(13), char(10) in it to text editor/excel- we notice data showing up in different rows. For this scenario we replace it by ‘ ‘ to get in 1 row.

select ‘a’+char(13)+’b’
select ‘a’+char(10)+’b’

SQL Carriage Returns or Tabs in SQL Server strings

Char(10) – New Line / Line Break

Char(13) – Carriage Return

Char(9) – Tab

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s