首页 > 数据库技术 > 详细

SqlServer查询数据库中所有表名,查询包含某个字段的表名

时间:2021-01-28 18:24:11      阅读:554      评论:0      收藏:0      [点我收藏+]
select name from sysobjects where xtype=u --读取库中的所有表名

select name from syscolumns where id=(select max(id) from sysobjects where xtype=u and name=表名) --读取指定表的所有列名

select * from sysobjects where xtype=u AND EXISTS(select 1 from syscolumns where id=sysobjects.id AND name=Attachment) --查询包含Attachment字段的表

嘻嘻

SqlServer查询数据库中所有表名,查询包含某个字段的表名

原文:https://www.cnblogs.com/HRainet/p/14338157.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!