SQL Server查询数据库ID

Posted 城南

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQL Server查询数据库ID相关的知识,希望对你有一定的参考价值。

select DB_ID(\'SBTERPDB\')

sql server 2008 查询数据库表的字段,以及字段说明

select a.name tabname,b.value,a1.name from sysobjects a left join  sys.columns a1 on a.id = a1.object_id
 left join sys.extended_properties b on b.major_id = a.id and b.minor_id = a1.column_id
 where a.name=‘表名‘

sysobjects:系统表 记录表名

sys.columns :记录表字段名

extended_properties : 表字段描述

以上是关于SQL Server查询数据库ID的主要内容,如果未能解决你的问题,请参考以下文章