SQL Server - 将存储过程从一个数据库复制到另一个数据库

问题描述:

我是 SQL 的新手,我需要做的是将 2 个 .mdf 数据库合并为一个.我使用 SQL Server 2008 Manager - 任务 > 导入/导出表来做到这一点.表和视图已成功复制,但新数据库中没有存储过程.有没有办法做到这一点?

I am new to SQL, and what I needed to do was to combine 2 .mdf databases into one. I did that using SQL Server 2008 Manager - Tasks > Import/Export tables.The tables and views were copied successfully, but there are no Stored procedures in the new database. Is there any way to do that?

  • 右键单击数据库
  • 任务
  • 生成脚本
  • 选择要编写脚本的对象
  • 脚本到文件
  • 针对目标数据库运行生成的脚本