SQLServer2005 批量查询自定义对象脚本
时间:2021-02-22 17:58:46|栏目:|点击: 次
object_definition的官方参考
http://msdn.microsoft.com/zh-cn/library/ms176090.aspx
以下代码可以批量查看或者导出视图、存储过程、触发器和函数的脚本
select name , xtype , object_definition (id ) from sysobjects
where xtype in ('V' , 'P' , 'TR' , 'IF' , 'TF' , 'FN' )
order by xtype , name
和上面代码等价的可以用 sys .sql_modules系统表代替 object_definition函数
select b. name , b. xtype , a . definition from sys .sql_modules a , sys .sysobjects b
where a . object_id = b. id
order by b. xtype
http://msdn.microsoft.com/zh-cn/library/ms176090.aspx
以下代码可以批量查看或者导出视图、存储过程、触发器和函数的脚本
复制代码 代码如下:
select name , xtype , object_definition (id ) from sysobjects
where xtype in ('V' , 'P' , 'TR' , 'IF' , 'TF' , 'FN' )
order by xtype , name
和上面代码等价的可以用 sys .sql_modules系统表代替 object_definition函数
复制代码 代码如下:
select b. name , b. xtype , a . definition from sys .sql_modules a , sys .sysobjects b
where a . object_id = b. id
order by b. xtype
上一篇:使用Bucardo5实现PostgreSQL的主数据库复制
栏 目:
下一篇:Powershell小技巧之通过EventLog查看近期电脑开机和关机时间
本文标题:SQLServer2005 批量查询自定义对象脚本
本文地址:http://www.codeinn.net/misctech/67508.html






