gpt4 book ai didi

mysql - 在 MSSQL 和 mySQL 中获取所有表及其数据

转载 作者:太空宇宙 更新时间:2023-11-03 11:13:53 25 4
gpt4 key购买 nike

考虑到我们不知道数据库中的表名,你们能告诉我如何获取所有表及其记录吗?

如:

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

另外,如果你能提供 mySQL 和 MSSQL 查询就更好了。

我认为它会起作用但没有成功:

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

最佳答案

对于 SQL Server 你可以使用这个:

exec sp_msforeachtable 'select * from ?'

关于mysql - 在 MSSQL 和 mySQL 中获取所有表及其数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6634007/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com