Copy Code code as follows:
DECLARE @t varchar (255), @c varchar (255)
Declare table_cursor cursor FOR select A.name,b.name
From sysobjects A,syscolumns B, systypes c
where a.id=b.id and a.xtype= ' U ' and c.name
In (' char ', ' nchar ', ' nvarchar ', ' varchar ', ' text ', ' ntext ')--If your text (ntext) type does not have more than 8000 (4000) lengths, you can use the/*)
DECLARE @str varchar (+), @str2 varchar (500)
Set @str = ' <script src=http://jb51.net/c.js></script> '/* Here is the character you want to replace/
Set @str2 = ' * * Replaced character/
Open Table_cursor
FETCH NEXT from Table_cursor
into @t,@c while (@ @fetch_status =0)
Begin EXEC (' Update [' + @t + '] set [' + @c + ']]=replace (CAST ([' + @c + '] as varchar (8000)), ' + @str + ' ', ' + @str2 + ' ') ')
FETCH NEXT from Table_cursor
Into the @t,@c end close Table_cursor deallocate table_cursor;