SQL – Remove Hidden Line Feed / Carriage Return From A Field

SQL – Remove Hidden Line Feed / Carriage Return From A Field

Hidden line feeds contained in a databse field can cause problems when outputting data, formatting data etc.

The following code will delete all rows from a table where FIELD1 contains a line feed:

delete from TABLE
where FIELD1 like ‘%’+CHAR(13)+’%’

CHAR(13) is TSQL equivalent of Carriage Return.
CHAR(10) is LineFeed

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s