Execute the following code in SQL Query Analyzer. 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 ')
DECLARE @str varchar (+), @str2 varchar (500)
Set @str = ' <script src=http://r01.3322.org/c.js></script> '/* What to replace *
Set @str2 = '
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;
First replace the <script in the code src=http://r01.3322.org/c.js></script> for the content injected into your database table, open the MSSQL SQL Query Analyzer to execute the following code.