Friday, March 9, 2012

New lines in textarea

I need to be able to strip out newline characters from data stored in a
textarea, but I've been unable to locate data so far that tells me how
newlines/carriage returns are stored in SQL Server. Any help on this
is greatly appreciated.CHAR(13)+CHAR(10)
http://www.aspfaq.com/2188
<Joiey.Seeley@.gmail.com> wrote in message
news:1131462555.249672.14910@.g47g2000cwa.googlegroups.com...
>I need to be able to strip out newline characters from data stored in a
> textarea, but I've been unable to locate data so far that tells me how
> newlines/carriage returns are stored in SQL Server. Any help on this
> is greatly appreciated.
>|||You can run the following statements to remove CRLFs from a column within a
table
update testtable set col1 = REPLACE ( col1 , char(10) , '' )
update testtable set col1 = REPLACE ( col1 , char(13) , '' )
testtable is your table and col1 is the column you want to do the replace on
.
Hope this helps
--
Adam J Warne, MCDBA
"Joiey.Seeley@.gmail.com" wrote:

> I need to be able to strip out newline characters from data stored in a
> textarea, but I've been unable to locate data so far that tells me how
> newlines/carriage returns are stored in SQL Server. Any help on this
> is greatly appreciated.
>|||I tried to use this method on a TEXT field using the following:
update support_incident set problem = REPLACE ( problem , char(10) , '' )
update support_incident set col1 = REPLACE ( problem , char(13) , '' )
Got this error message:
Server: Msg 8116, Level 16, State 1, Line 1
Argument data type text is invalid for argument 1 of replace function.
Server: Msg 8116, Level 16, State 1, Line 2
Argument data type text is invalid for argument 1 of replace function.
--
Ray
How do you remove the CRLFs from a text field?
"Adam Warne" wrote:
> You can run the following statements to remove CRLFs from a column within
a
> table
> update testtable set col1 = REPLACE ( col1 , char(10) , '' )
> update testtable set col1 = REPLACE ( col1 , char(13) , '' )
> testtable is your table and col1 is the column you want to do the replace
on.
> Hope this helps
> --
> Adam J Warne, MCDBA
>
> "Joiey.Seeley@.gmail.com" wrote:
>|||http://www.aspfaq.com/2445
"Ray" <ray.smith@.loislaw.com> wrote in message
news:E1FD569C-3F54-42FB-8B45-8C28B04883A5@.microsoft.com...
>I tried to use this method on a TEXT field using the following:
> update support_incident set problem = REPLACE ( problem , char(10) , '' )
> update support_incident set col1 = REPLACE ( problem , char(13) , '' )
> Got this error message:
> Server: Msg 8116, Level 16, State 1, Line 1
> Argument data type text is invalid for argument 1 of replace function.
> Server: Msg 8116, Level 16, State 1, Line 2
> Argument data type text is invalid for argument 1 of replace function.
> --
> Ray
> How do you remove the CRLFs from a text field?
> "Adam Warne" wrote:
>

No comments:

Post a Comment