sqlserver 操作对象命令

1、显示指定的表或视图的数据和索引的碎片信息。

 

DBCC SHOWCONTIG

 

2、查询存储过程名称和存储过程代码

 

select OBJECT_NAME(id) as 过程名,[text] as 过程代码
from dbo.syscomments 
where id in (select [id] from sysobjects where type='p') 

 

3、查询当前数据库的视图

 

select object_name(c.id) as obj_name,[text] as code
from syscomments c ,sysobjects o 
where c.id=o.id
and o.type='v'
and object_name(c.id)='view的名字'
order by obj_name


 


 

posted @ 2013-06-13 17:11  wala-wo  阅读(194)  评论(0编辑  收藏  举报