当前位置:Gxlcms > 数据库问题 > SQL Server —— 查询数据库、表、列等

SQL Server —— 查询数据库、表、列等

时间:2021-07-01 10:21:17 帮助过:4人阅读

*from sys.databases where name=MyDatabase

技术分享

二、查询表(sysobjects —— select *from sysobjects where id=OBJECT_ID(‘<表名>‘))

select *from sysobjects where id=OBJECT_ID(StudentsInfo)

技术分享

三、查询列(syscolumns —— select COUNT(*) from syscolumns where name=‘<列名>‘ and id=OBJECT_ID(‘<表名>‘))

select COUNT(*) from syscolumns where name=sname and id=OBJECT_ID(studentsinfo)

技术分享

 四、查询存储过程或视图(select * from sysobjects where name=‘<视图或存储过程名>‘  AND  type  =  ‘P/V‘)

SQL Server —— 查询数据库、表、列等

标签:_id   img   server   image   存储   style   数据库   name   databases   

人气教程排行