/ Published in: SQL
Clears supplied text from database tables.
Does not clear the string out of TEXT or NTEXT tables.
Does not clear the string out of TEXT or NTEXT tables.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
DECLARE @SQL NVARCHAR(4000) DECLARE @InsertedValue NVARCHAR(1000) SET @InsertedValue = 'The Script tags which were inserted' DECLARE cur CURSOR FOR SELECT 'update [' + sysusers.name + '].[' + sysobjects.name + '] set [' + syscolumns.name + '] = replace([' + syscolumns.name + '], ''' + @InsertedValue + ''', '''')' FROM syscolumns JOIN sysobjects ON syscolumns.id = sysobjects.id AND sysobjects.xtype = 'U' JOIN sysusers ON sysobjects.uid = sysusers.uid WHERE syscolumns.xtype IN (35, 98, 99, 167, 175, 231, 239, 241, 231) OPEN cur FETCH NEXT FROM cur INTO @SQL WHILE @@FETCH_STATUS = 0 BEGIN EXEC (@SQL) FETCH NEXT FROM cur INTO @SQL END CLOSE cur DEALLOCATE cur