--查询所有表名
select name from dbo.sysobjects where xtype='u' and (not name LIKE 'dtproperties')
--查询所有表的所有字段名
SELECT dbo.sysobjects.name as Table_name, dbo.syscolumns.name AS Column_name
FROM dbo.syscolumns INNER JOIN
dbo.sysobjects ON dbo.syscolumns.id = dbo.sysobjects.id
WHERE(dbo.sysobjects.xtype = 'u') AND (NOT (dbo.sysobjects.name LIKE 'dtproperties'))
--查询指定表的所有字段名
SELECT dbo.sysobjects.name as Table_name, dbo.syscolumns.name AS Column_name
FROM dbo.syscolumns INNER JOIN
dbo.sysobjects ON dbo.syscolumns.id = dbo.sysobjects.id
WHERE dbo.sysobjects.name='表名'and (dbo.sysobjects.xtype = 'u') AND (NOT (dbo.sysobjects.name LIKE 'dtproperties'))
select b.name 表名,a.name 字段名 from syscolumns a join sysobjects b on a.id=b.id where b.xtype = 'U'
xtype 是表的性质,U是用户表,系统表是S
有两种方法:
1.select b.name 表名,a.name 字段名 from syscolumns a join sysobjects b on a.id=b.id where b.xtype = 'U'
2.select [name] from sysobjects where id in(select id from syscolumns Where name='字段名')
2008没用过,不懂!不过我觉得应该和2003或者2005是一样的操作,因为他们都使用的SQL语句,变化应该不是很大!
use BIRD
select * from A,B,C,D,E from tableName