开发者

Fetching all the tables and their data in MSSQL and mySQL

开发者 https://www.devze.com 2023-03-19 05:26 出处:网络
Can you guys tell me how to fetch all the tables 开发者_如何学Calong with their records considering we don\'t know the table names in the database.

Can you guys tell me how to fetch all the tables 开发者_如何学Calong with their records considering we don't know the table names in the database.

Such as :

use my_database
select * from information_schema.tables 
-- gives all the tables from a database 

Also it would be great if you can give mySQL and MSSQL queries.

I thought it would work but didn't work out:

select * from (select [TABLE_NAME] from INFORMATION_SCHEMA.TABLES)


For SQL Server you can use this:

exec sp_msforeachtable 'select * from ?'
0

精彩评论

暂无评论...
验证码 换一张
取 消