Αποτελέσματα Αναζήτησης
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%'
The REPLACE() function replaces all occurrences of a substring within a string, with a new substring. Note: The search is case-insensitive. Tip: Also look at the STUFF() function.
Transact-SQL reference for the REPLACE function, which replaces all occurrences of a specified string value with another string value.
In this tutorial, you will learn how to use the SQL Server REPLACE() function to replace all occurrences of a substring by a new substring within a string.
24 Ιαν 2022 · The REPLACE SQL function is used to replace a string or substring of a string with another string in a T-SQL script, SELECT statement, UPDATE statement, SQL query or stored procedure in a Microsoft SQL database. Syntax
SQL provides a very helpful string function called REPLACE that allows you to replace all occurrences of a substring in a string with a new substring. The following illustrates the syntax of the REPLACE function: REPLACE (string, old_substring, new_substring); Code language: SQL (Structured Query Language) (sql)
Let’s start the page by explaining the simple SQL definition, syntax, and basic example, replacing table columns, replacing Nulls with 0, and updating old text with the new string. The SQL REPLACE function helps replace existing substring with a user-specified new string.