在SQL Server中
每一个database裡都有一个系统所产生的table
sysobjects这一个table中记录了database中所有的table名称
我们可以用下面的SQL语法作查询的动作
复制代码 代码如下:
Select Name,id from sysobjects where xtype = "U"
其中xtype="U"代表使用的table,若是使用xtype="S"
则代表系统预设的table
在系统table中还有一个名叫syscolumns的table
他记录了栏位的资料
若是想要找出某一个table的栏位相关资料,可以用下面的SQL语法..
复制代码 代码如下:
Select Name from syscolumns where id in (Select id from sysobjects where name= "
Table_name" and xtype="U")