//获取表名,列名
SELECT TOP 100 PERCENT AS e_table_name, AS e_column_name,
AS e_column_type
FROM dbo.sysobjects INNER JOIN
dbo.syscolumns ON dbo.sysobjects.id = dbo.syscolumns.id INNER JOIN
dbo.systypes ON dbo.syscolumns.xtype = dbo.systypes.xtype
where = 'info_bridge'
ORDER BY
/**
*获取主键
*/
select COLUMN_NAME = convert(sysname,)
from
sysindexes i, syscolumns c, sysobjects o
where o.id = object_id('[YourTableName]')
and o.id = c.id
and o.id = i.id
and (i.status & 0x800) = 0x800
and ( = index_col ('[YourTableName]', i.indid, 1) or
= index_col ('[YourTableName]', i.indid, 2) or
= index_col ('[YourTableName]', i.indid, 3) or
= index_col ('[YourTableName]', i.indid, 4) or
= index_col ('[YourTableName]', i.indid, 5) or
= index_col ('[YourTableName]', i.indid, 6) or
= index_col ('[YourTableName]', i.indid, 7) or
= index_col ('[YourTableName]', i.indid, 8) or
= index_col ('[YourTableName]', i.indid, 9) or
= index_col ('[YourTableName]', i.indid, 10) or
= index_col ('[YourTableName]', i.indid, 11) or
= index_col ('[YourTableName]', i.indid, 12) or
= index_col ('[YourTableName]', i.indid, 13) or
= index_col ('[YourTableName]', i.indid, 14) or
= index_col ('[YourTableName]', i.indid, 15) or
= index_col ('[YourTableName]', i.indid, 16)
)
declare @table_name as varchar(max)
set @table_name = '你的表名'
select , , sys.columns.max_length, sys.columns.is_nullable,
(select count(*) from sys.identity_columns where sys.identity_columns.object_id = sys.columns.object_id and sys.columns.column_id = sys.identity_columns.column_id) as is_identity ,
(select value from sys.extended_properties where sys.extended_properties.major_id = sys.columns.object_id and sys.extended_properties.minor_id = sys.columns.column_id) as description
from sys.columns, sys.tables, sys.types where sys.columns.object_id = sys.tables.object_id and sys.columns.system_type_id=sys.types.system_type_id and http://doc.guand
ang.net=@table_name order by sys.columns.column_id
一、oracle
1、获取当前oracle数据库中的所有表
select table_name from user_tables
2、查询某