Results 1 to 6 of 6
  1. #1
    Join Date
    Dec 2003
    Posts
    7

    Question Unanswered: Adding a line feed in a text-data type column

    exec sp_dboption 'duvialla', 'select into/bulkcopy', 'true'
    declare @v_1 binary(16)
    select @v_1 = textptr(info) from info_cust_history where cust_id = 105150
    updatetext info_cust_history.info @v_1 null 0 'Adding this text'
    go
    exec sp_dboption 'duvialla', 'select into/bulkcopy', 'false'


    How can I add a line feed or carrige return at the end of each line? Can I use CHAR(10) or CHAR(13) in any way on a text datatype? I can't just add CHAR(10) at the end, bacuse it just prints it as "normal" text into the column...

    Please help me or suggest an alternative solution!

    Thanx in advance!
    //Moonstalker

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    select 'Line1' + char(10) + 'Line2'

  3. #3
    Join Date
    Dec 2003
    Posts
    7
    Originally posted by blindman
    select 'Line1' + char(10) + 'Line2'
    But does that work if i wnat to update an existing text in a column of text data type?

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    create table TextTest (TextString text)
    insert into TextTest (TextString) values('Line1')
    update TextTest set TextString = cast(TextString as varchar(8000)) + Char(10) + 'Line2'
    select * from TextTest
    drop table TextTest

    This will only work if the current string is less than 8000 characters long.

    blindman

  5. #5
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    I hate text...

    Is any of your data > 8000?

    Did you inherit the database?

    If not, did you use text because access uses text?

    Look at UPDATETEXT READTEXT WRITETEXT and TXTPTR in bol

    hey blindman...long time no post...
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  6. #6
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    I took a long weekend. Lots of left-overs to dispose of.

    blindman

Posting Permissions

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