博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

[遗忘]SQL获取table列名及DB中所有table及按内容查找

Posted on 2011-07-27 09:49  happyst  阅读(355)  评论(0)    收藏  举报

select name from syscolumns where id = object_id('table')----get columns;

select    name    from    sysobjects    where    type='U'----get all tables in DB;

 -----搜索存储等
SELECT sys.id,  sys.text, obj.name
FROM syscomments SYS Inner join  sysobjects obj on sys.id = obj.id
WHERE sys.id IN (SELECT id FROM sysobjects)
and text like '%搜寻内容%'
ORDER BY colid
 

----其它:

select * from information_schema.tables
select * from information_schema.views
select * from information_schema.columns