(1)
select * from information_schema.tables
(2)
select name from dbo.sysobjects where xtype='u' and (not name like 'dtproperties')
(3)
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='tm_user'and (dbo.sysobjects.xtype = 'u') and (not (dbo.sysobjects.name like 'dtproperties'))
(4)
declare @str varchar(100)
set @str='1' --要搜尋的字串
declare @s varchar(8000)
declare tb cursor local for
select s='if exists(select 1 from ['+b.name+'] where convert(varchar,['+a.name+']) like ''%'+@str+'%'')
print ''select top 5 ['+a.name+'],* from ['+b.name+']'''
from syscolumns a join sysobjects b on a.id=b.id
where b.xtype='u' and a.status>=0
--所查列的字段型別
and a.xusertype in(175,239,231,167,56,60,108,106)
open tb
fetch next from tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch next from tb into @s
end
close tb
deallocate tb
(5)
oracle版:
列出當前db中所有表:
select table_name from user_all_tables
列出表中所有字段:
select column_name from user_tab_columns where table_name='edl_tm_user')
sql查詢資料庫中所有表名 續
讀取庫中的所有表名 select name from sysobjects where xtype u 讀取指定表的所有列名 select name from syscolumns where id select max id from sysobjects where xtype u and na...
查詢資料庫中所有表名,查詢表中所有欄位名
mysql 1.查詢資料庫中所有表名稱 select table name from information schema.tables where table schema 資料庫名稱 包含檢視 select table name from information schema.tables wh...
利用SQL語句查詢資料庫中所有表
oracle select from all tables 系統裡有許可權的表 select from dba tables 系統表 select from user tables 當前使用者下的表 sql server 1,利用sysobjects系統表 在這個表中,在資料庫中建立的每個物件 例如...