Created
January 28, 2021 10:23
-
-
Save Dzoge/ebf7be3d3a6de1ff3b4334aa01e5e5b4 to your computer and use it in GitHub Desktop.
Replace text in all NVARCHAR type columns in all tables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
'UPDATE ['+TABLE_SCHEMA+'].['+table_name+'] SET ['+column_name+'] = REPLACE(['+column_name+'], ''existing-text'', ''new-text'');' | |
--,table_name as [TableName] | |
--,column_name as [ColumnName] | |
--,TABLE_SCHEMA as [SchemaName] | |
from information_schema.columns | |
where data_type = 'nvarchar' | |
and character_maximum_length=-1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment