Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3442990
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:44:12+00:00 2026-05-18T08:44:12+00:00

I need to update/replace the data in datatable.column. The table has a field named

  • 0

I need to update/replace the data in datatable.column. The table has a field named Content. I’m using the REPLACE function. Since the column datatype is NTEXT, SQL Server doesn’t allow me to use the REPLACE function.

I can’t change the datatype because this database is 3rd party software table. Changing the datatype will cause the application to fail.

UPDATE [CMS_DB_test].[dbo].[cms_HtmlText] 
SET Content = REPLACE(Content,'ABC','DEF') 
WHERE Content LIKE '%ABC%' 

I Receive this error:

Msg 8116, Level 16, State 1, Line 1
Argument data type ntext is invalid for argument 1 of replace function.

  • Can I fix this with T-SQL? Does someone have an example how to read and to loop?
  • Since this is onetime conversion, maybe I can change to another type but I’m afraid I’m messing up the data.

There is a primary key field: name: ID – integer – it’s an identity…. So I need to think about this too. Maybe set the Identity to N temporary.

Please advise on how to achieve the REPLACE function?

Approx. 3000 statements need to be updated with a new solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:44:13+00:00Added an answer on May 18, 2026 at 8:44 am

    IF your data won’t overflow 4000 characters AND you’re on SQL Server 2000 or compatibility level of 8 or SQL Server 2000:

    UPDATE [CMS_DB_test].[dbo].[cms_HtmlText] 
    SET Content = CAST(REPLACE(CAST(Content as NVarchar(4000)),'ABC','DEF') AS NText)
    WHERE Content LIKE '%ABC%' 
    

    For SQL Server 2005+:

    UPDATE [CMS_DB_test].[dbo].[cms_HtmlText] 
    SET Content = CAST(REPLACE(CAST(Content as NVarchar(MAX)),'ABC','DEF') AS NText)
    WHERE Content LIKE '%ABC%' 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to delete data from a table using a SQLDataAdapter , and
I need to take production data with real customer info (names, address, phone numbers,
I need to recv() data from a socket and store it into a buffer,
I have a Google Chart (using the Google Visualization API , not Google Charts
First off, im using a checkbox to highlight a true or false value from
I'm using sqlite as a datasource in an iPhone app. I have two questions
I have an audit table in my SQL Server 2008 database which contains the
I'm having trouble setting up this code to export the text in the format
The following code snippet on SQL server 2005 fails on the ampersand '&': select
What is the best and fast ORM to use with Oracle for .NET ?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.