Re: How do I preserve carriage returns in SQL?

From: Daniel Crichton (msnews_at_worldofspack.co.uk)
Date: 03/21/05


Date: Mon, 21 Mar 2005 19:05:10 -0000

Joseph wrote on Mon, 21 Mar 2005 13:42:59 -0500:

> Hi Dan,
>
> Thanks for your reply. You are absolutely correct. We are submitting the
> SQL through the ADO Connection.Execute method. However, I did find a bit
> of code which was replacing vbCrLf with " ". Duh! :-)
>
> Anyway, with that out of the way, I'm finding that the data makes its way
> into the table complete with carriage returns. Or more precisely, complete
> with line feeds. I'm finding on the retrieval side that I need to execute
> the following string replacement in order for the data to display
> correctly in a multi-line textbox.
>
> RS("Alert") = Replace(RS("Alert"), vbLf, vbCrLf)
>
> I'm guessing that if I'd be writing this to the table via a Recordset this
> wouldn't be an issue. This is the way most of our database updates are
> applied and I've never noticed carriage returns to be an issue. However,
> since we're doing this particular update via embedded SQL it seems that
> line-breaks go into the database as the vbLf character, while a vbCrLf is
> needed in order to properly display a newline in a textbox.
>
> Does this sound correct?

Just checked what SQL Query Analyzer (I'm using the SQL 2000 version) wrote
into my row, it has both CR and LF as the line breaks. Where is your SQL
statement coming from? The source of the issue will be whatever is writing
that data into the row.

Dan



Relevant Pages

  • Re: How to understand huge code
    ... product) I feel very difficult understanding the complete code flow. ... writing it in a semi-programming language helps reduce clutter. ... For things like SQL, I ask myself what the SQL is retrieving ...
    (comp.programming)
  • Re: NEED TO GO FASTER
    ... Writing your entire message in UPPER CASE is considered shouting, ... entirely written in upper case, then it is very had to read (especially ... SQL is a set oriented language, ... Make sure the proper indexes are in place. ...
    (comp.databases.ms-sqlserver)
  • Re: Querying a DataSet/DataTable in .NET
    ... to writing an in-memory database engine. ... >>>I think it would be nice if we could have a SQL engine available on the ... >>> display only (I could put it in business objects so I can reuse the ...
    (microsoft.public.dotnet.general)
  • Re: Large dataset performance
    ... in SQL. ... Understand better set operations on SQL and ... application would be writing data to the database and this cannot ... of underlying principles. ...
    (comp.databases.theory)
  • Re: searching for yoda - a developers tale
    ... The mundane problems are with simply writing out the SQL queries to ... include the JOIN clauseand not have any typos. ... that the folks in relational db land have understood for decades. ...
    (comp.lang.java.programmer)