将一个数据库复制到另一个数据库 [英] Copy one database to another database

查看:85
本文介绍了将一个数据库复制到另一个数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从一个数据库复制到另一个数据库.

How to copy from one database to another database.

数据库名称 visco

Database name visco

我想将所有表从 visco 数据库复制到新的数据库名称为 neptune

I want to copy all the table from visco database to new database name as neptune

我创建了一个没有任何表的数据库,然后我尝试从 database1.bak 文件恢复数据库,然后它显示错误为

I was created one database with out any tables, then i try to restore the database from database1.bak file, then it is showing error as

You are attempting to overwrite an existing database.  Check the force restore over existing database option to 
overwrite the existing database.

需要查询帮助

推荐答案

使用 SQL Server Management Studio:

Using the SQL Server Management Studio:

选项 1

-> 右键单击​​要复制的数据库
-> 选择任务">生成脚本"
-> '选择特定的数据库对象'
-> 检查表格"
-> 标记保存到新的查询窗口"
-> 点击高级"
-> 将脚本的数据类型"设置为架构和数据"
-> 下一个,下一个 :)

-> Right click on the database you want to copy
-> Choose 'Tasks' > 'Generate scripts'
-> 'Select specific database objects'
-> Check 'Tables'
-> Mark 'Save to new query window'
-> Click 'Advanced'
-> Set 'Types of data to script' to 'Schema and data'
-> Next, Next :)

您现在可以在新数据库上运行生成的查询.

You can now run the generated query on the new database.

选项 2

-> 右键单击​​要复制的数据库
->任务">导出数据"
-> 下一个,下一个 :)
-> 选择将表复制到的数据库
-> 标记从一个或多个表或视图复制数据"
-> 选择要复制的表格
-> 完成

-> Right click on the database you want to copy
-> 'Tasks' > 'Export Data'
-> Next, Next :)
-> Choose the database to copy the tables to
-> Mark 'Copy data from one or more tables or views'
-> Choose the tables you want to copy
-> Finish

这篇关于将一个数据库复制到另一个数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆