appending to a ntext field in SQL Server

Results 1 to 2 of 2

Thread: appending to a ntext field in SQL Server

  1. #1
    b-day & beer Guest

    Default appending to a ntext field in SQL Server

    I am assembling a string of a couple of fields with the Ascii characters for return and line feed. Part of the string will be a textarea field. I have a field in the database to store this string. The field will be running combination of comments made by people, and I want the user to pull up the field and read all comments, seperated by a line feed.<BR><BR>I have not been able to find much direction on appending to text fields in SQL Server or ASP in my resources. I know this is a simple issue, I would just prefer some leads before I waste too much time on it. <BR><BR>Thanks a bunch

  2. #2
    Join Date
    Dec 1969

    Default RE: appending to a ntext field in SQL Server

    Not sure you can put a linefeed into a SQL "Update" command (which is what it sounds like you will be using) from ASP. You may need to use a substitute character and then Replace it when you read the text back out again. You might use something like &#060;P&#062; as the substitute, so that if you ever do decide to show the text as HTML, you wouldn&#039t then need to even do the substitution.<BR><BR>As for the syntax, I *THINK* it is something simple, such as:<BR><BR>UPDATE table SET theField = Concat(theField,&#039the text&#060;p&#062;with substituted line breaks&#039);<BR><BR>(Concat is in ANSI SQL whereas other means of concatenating strings may not be.)<BR><BR>Sorry I don&#039t have a more definitive answer, but mayhap this will get you started?<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts