Wednesday, March 7, 2012

Newline in Data

Hello,

I have data in a database table that has newline data in it. It has a newline character in front of the text of the data, and for some reason, I can't figure out how I can replace it. I've tried entering in a return character between '' and I've tried trimming the text... How do I represent a newline character to remove it from the text?

Thanks.

If the data is already in SQL Server, and you just want to update thedata to not have the newline in it, and the newline is the first partof the text, this should do it. Make sure to test on sample dataFIRST!
update myTable
set myColumn = right(myColumn, len(myColumn) - 2)
where left(myColumn, 2) = CHAR(13) + CHAR(10)

No comments:

Post a Comment