0

这是不起作用的代码:

DECLARE @myTable TABLE (colName nvarchar(500), tableName nvarchar(500))

insert into @myTable

SELECT c.COLUMN_NAME AS colName, c.TABLE_NAME AS tableName, TABLE_SCHEMA tableSchema 
FROM information_schema.COLUMNS as c 
WHERE c.COLUMN_NAME like '%password%'

select * from @myTable

我的错误是:

[错误] 脚本行:1-7 -------------- 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在 'DECLARE @myTable TABLE (colName nvarchar(500), tableName nvarchar(500)) 附近使用正确的语法

insert ' at line 1 

有人有想法么?

4

2 回答 2

1

Mysql有点不同:

create table myTable (colName nvarchar(500), tableName nvarchar(500));

insert into myTable (colName, tableName)
    SELECT COLUMN_NAME, TABLE_NAME
    FROM information_schema.COLUMNS
    WHERE COLUMN_NAME like '%password%';

select * from myTable;
于 2012-10-22T11:12:14.640 回答
0

你可以试试这个

  insert into myTable  

 SELECT c.COLUMN_NAME AS colName, c.TABLE_NAME AS tableName 
 FROM information_schema.COLUMNS as c 
 WHERE c.COLUMN_NAME like '%password%'
于 2012-10-22T11:10:06.973 回答