获得列名 select name from syscolumns where id=object_id('ds_field')
--读取库中的所有表名
--读取指定表的所有列名
方法如下:先从SYSTEMOBJECT系统表中取得数据表的SYSTEMID,然后再SYSCOLUMN表中取得该数据表的所有列名。 SQL语句如下: declare @objid int,@objname char(40) set @objname = 'tablename' select @objid = id from sysobjects where id = object_id(@objname) select 'Column_name' = name from syscolumns where id = @objid order by colid 自己修改如下,可以直接放到JSP中执行 SELECT name FROM syscolumns WHERE (id = (SELECT id FROM sysobjects WHERE (id = OBJECT_ID('YOURTABLENAME')))) ORDER BY colid |