Development resources, articles, tutorials, code samples, tools and downloads for ASP.Net, SQL Server, Reporting Services, T-SQL, Windows, AWS, SAP HANA and ABAP
Update Text, NText Columns using UPDATETEXT Command in MS SQL Server
Text, NText field are common data types used as data types of table columns in MS SQL Server databases.
With Microsoft SQL Server 2005, new data types like varchar(max) and nvarchar(max) are introduced to SQL Server sql developers and SQL Server database administrators (DBA)
But probably in many SQL Server installations SQL200 databases are still active.
Or on places where SQL Server 2000 databases are migrated to or upgraded to SQL Server 2005, probably not yet those text and ntext columns are converted to new data types varchar(max) and nvarchar(max).
So we might need to work on text and ntext data type columns and deal with the limitations of text and ntext data types in t-sql.
Let's begin coding t-sql on your development or test SQL Server databases by creating a test table which we will insert some sample data.
After populating sql table with data sample data, we can execute UPDATETEXT command pver this sample SQL Server table in order to replace string values on data type TEXT and NTEXT columns.
Here is sample t-sql code using UPDATETEXT command.
And I have build a sql stored procedure to execute dynamic t-sql codes on SQL Server databases for updating text or ntext column values.
Here is an example showin the use the sql ReplaceTextColumn stored procedure in an.
I hope this T-SQL sample codes using UPDATETEXT will help you to find and replace string value in text/ntext column.