• The Replace() function doesn't work on Text and NText fields in SQL 2000. You have to use SubString() and/or Stuff() and cycle through the column or variable changing the first found instance of the pattern until they are all accounted for.

     

    Declare

    @Table Table (Myfield text not null)

    Insert

    Into @Table

    <SELECTReplicate('1236547890', 10000)

    Update

    @Table

    Set MyField = Replace(MyField, '654', '456')---------------------------------------------------

    Msg 8116, Level 16, State 1, Line 6

    Argument data type text is invalid for argument 1 of replace function.


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]