Updating TEXT data type field

  • Hi

    I need to append the value for an existing text data type column value in sql 2000. Can someone give the scripts? I have to update for 300 records.

    Thanks

    Shuaib

  • Hi

    In SQL Server 2000 I think there is no set based solution. You have to work with WRITETEXT function:

    CREATE TABLE #t (Id INT, Txt TEXT)

    INSERT INTO #t

    SELECT 1, 'Hello '

    DECLARE @ptr BINARY(16)

    DECLARE @offset INT

    SELECT @ptr = TEXTPTR(Txt), @offset = DATALENGTH(Txt)

    FROM #t

    WHERE Id = 1

    UPDATETEXT #t.Txt @ptr @offset 0 'World'

    GO

    SELECT * FROM #t

    GO

    GO

    DROP TABLE #t

    Please correct me if I'm wrong.

    Greets

    Flo

  • Shuaib (4/10/2009)


    Hi

    I need to append the value for an existing text data type column value in sql 2000. Can someone give the scripts? I have to update for 300 records.

    Thanks

    Shuaib

    For editing text it would be logical to use a text editor.

    Transactional Structured Query Language has nothing to do with this.

    _____________
    Code for TallyGenerator

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply