-- 獲得存儲(chǔ)過程創(chuàng)建語句
select o.xtype,o.name,cm.text from syscomments cm 
inner join sysobjects o on o.id=cm.id 
where xtype ='p'
order by o.xtype,o.name,cm.text
-- 獲得視圖程創(chuàng)建語句
select o.xtype,o.name,cm.text from syscomments cm 
inner join sysobjects o on o.id=cm.id 
where xtype ='v'
order by o.xtype,o.name,cm.text
-- 查詢所有表名、字段名、類型、長(zhǎng)度
select o.name, c.name,t.name,c.length from syscolumns c
inner join systypes t on c.xtype= t.xtype
inner join sysobjects o on c.id= o.id
where   o.xtype='u'
order by  o.name, c.name,t.name
-- 所有數(shù)據(jù)都來自于這四張表
--select * from sysobjects  
--select * from syscolumns
--select * from syscomments
--select * from systypes