===========================================================
查询某个数据库在服务器上的ID号,信息
use master
select * from sysdatabases
----或者
select DB_ID(N'数据库名') --数据库ID
select OBJECT_ID(N'表名') --表名
注意在使用这 2个函数的时候,不能被"()"包围,也就是说 select (db_id('dbName')) from sysdatabases-是错误的
可以 先 声明 declare @dbID-@dbID=db_id('dbName')--然后再查询
===========================================================
查询sql2000版本号--select serverproperty('productlevel')
查询系统版本号 --select @@version
===========================================================
sysname - 数据类型 相当于 varchar(256) ,但多了 not null 这一个限制
===========================================================
根据字段名找表--select b.name from syscolumns a join sysobjects b on a.id=b.id where a.name='字段名'
===========================================================