今天遇到了一个问题,需要把原数据库的一些数据导入到新数据库中,其中包括700多条存储过程。

开始通过sql语句查询出所有的存储过程,然后再创建,发现创建存储过程时不能同时创建多个。

select sm.object_id, object_name(sm.object_id) as object_name, o.type, o.type_desc, sm.definition
    from sys.sql_modules sm inner join sys.objects o on sm.object_id = o.object_id
        where o.type = 'P' and o.name not like '%diagram%' order by o.name;
View Code

相关文章: