我在sqlserver中使用此查询并在mysql中需要相同的查询..我在mysql中是新的..请帮我解决此问题。
DECLARE @sql AS nvarchar(max)
set @sql=''
set @sql='Select * From('
SELECT @sql = @sql + N'
SELECT name FROM ['+ SCHEMA_NAME(schema_id) +'].[' + name + ']
UNION ALL '
FROM information_schema.`TABLES` T where table_name like 'Custom%'
SELECT @sql = SUBSTRING(@sql, 0, len(@sql)-9)
print @sql
问候
答案 0 :(得分:0)
试
set @sql = '';
set @sql='Select * From(';
SELECT @sql = @sql + N'
SELECT name FROM ['+ TABLE_SCHEMA +'].[' + TABLE_NAME + ']
UNION ALL '
FROM information_schema.`TABLES` T where table_name like 'Custom%';
SELECT @sql = SUBSTRING(@sql, 0, length(@sql)-9);
select @sql