August 25, 2006 at 8:45 am
Hi,
I have use a HTML control TextArea to let users input free format text in it. Users can input save linefeed-return charactes (next line characters) in that textbox. But when I saved it in a varchar-datatyped column of a db table, those characters are saved as space blank characters. So, how can I save linefeed-return charactes in that varchar-datatyped column?
Thanks.
August 25, 2006 at 9:10 am
John,
You could replace them with char(13)
create table #test(test varchar(8000))
INSERT #test (test) VALUES ('This ' + char(13) + 'is a ' + char(13) + 'test' )
select * from #test
drop table #test
Jan
September 6, 2006 at 2:32 pm
Jan,
But when you let user input free format text in an html TextArea and save it in an SQL server table column who belongs to varchar type, how do you know linefeed return characters saved in that column by looking in the column contents? I mean using SELECT mycolumn from mytable in QA, how such do special linefeed return characters look like?
Thanks.
September 6, 2006 at 3:05 pm
John,
The easiest thing is save your result to a file, result will be same as user entered in free format text (including line feeds)
Char(13) is not a visible character
September 6, 2006 at 6:56 pm
The problem is that carriage returns mean nothing in HTML... your app has to capture user induced line breaks as <br> in order for them to mean anything in HTML.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply