SQL Server 批量导出存储过程、视图和函数

发布时间 2023-08-19 14:01:55作者: 邵彷
select a.name,a.[type],b.[definition] 
FROM sys.all_objects a,sys.sql_modules b 
where a.is_ms_shipped=0 and a.object_id = b.object_id and a.[type] in ('P','V','AF') 
order by a.[name] asc

当 type 为‘ P’ 时,为存储过程

当 type 为‘ V’ 时,为视图

当 type 为‘ AF’ 时,为函数