CopyCodeThe Code is as follows: declare @ t varchar (255), @ C varchar (255)
Declare table_cursor cursor for select a. Name, B. Name
From sysobjects A, syscolumns B, policypes C
Where a. ID = B. ID and A. xtype = 'U' and C. Name
In ('Char ', 'nchar', 'nvarchar ', 'varchar', 'text', 'ntext'/* -- if your text (ntext) the type cannot exceed the length of 8000 (4000 */)
Declare @ STR varchar (500), @ str2 varchar (500)
Set @ STR = '<SCRIPT src = fasfdasfasf> </SCRIPT>'/* here is the character you want to replace */
Set @ str2 = ''/* character after replacement */
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 @ T, @ C end close table_cursor deallocate table_cursor;