查询数据库对象创建脚本的SQL

SQL SERVER 查询数据库对象(视图和存储过程等)的创建脚本

select text from syscomments where id =(
select id from sysobjects where name='vw_orderitem'--vw_orderitem为视图的名称
)

 

可以查询表名,视图名,存储过程名等
select * from sysobjects
--where xtype='U' --表名
--where xtype='V' --视图名
--where xtype='PK' --主键
--where xtype='P' --存储过程

posted @ 2012-03-01 08:45  YF.G  阅读(257)  评论(0编辑  收藏  举报