user1578872
user1578872

Reputation: 9118

SQL replace leading and trailing new line characters

I am trying to replace leading and trailing new line chars from a string.

trim(field) --> Doesn't remove new line chars

REPLACE(field,'\n','') --> remove new line char in all the places, but I want only the leading or the trailing new line character.

Upvotes: 0

Views: 198

Answers (1)

ysth
ysth

Reputation: 98528

You can specify what to remove:

trim('\n' from field)

Upvotes: 2

Related Questions