且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将一个数据库的模式和数据复制到其他数据库

更新时间:2023-02-02 22:28:38

看到类似的答案:搬家数据库从一个数据库表到另一个数据库表 [ ^ ]



我建议您使用复制数据库向导 [ ^ ]。



其他资源:

SQL SERVER - 将数据库从实例复制到另一个实例 - 在SQL Server中复制粘贴 [ ^ ]

SQL SERVER - 2008 - 使用数据复制数据库 - 生成用于将数据从一个表插入另一个表的T-SQL [ ^ ]

将数据库从一台服务器移动到SQL Server 2008中的另一台服务器 [ ^ ]
See similar answer: Moving Datas from One database Table to another database table[^]

I would suggest you to use Copy Database Wizard[^].

Other resources:
SQL SERVER – Copy Database from Instance to Another Instance – Copy Paste in SQL Server[^]
SQL SERVER – 2008 – Copy Database With Data – Generate T-SQL For Inserting Data From One Table to Another Table[^]
Move a database from one server to another server in SQL Server 2008[^]


看看这对你有用..



http://blog.sqlauthority.com/2011/05/07/sql-server-2008-2008-r2-create-script-to-copy- database-schema-and-all-the-objects-data-schema-stored-procedure-functions-triggers-tables-views-constraints-and-all-other-database-objects / [ ^ ]
See if this works for you..

http://blog.sqlauthority.com/2011/05/07/sql-server-2008-2008-r2-create-script-to-copy-database-schema-and-all-the-objects-data-schema-stored-procedure-functions-triggers-tables-views-constraints-and-all-other-database-objects/[^]


创建链接服务器在您当前的服务器中,您希望在哪里提取数据...



然后在当前服务器中执行以下查询,无论您想要哪个数据库:



Create a linked server in your current server, where you want your data to be pulled...

Then execute the below query in your current server, whichever DB you want:

Insert into MyCurrentDB.Schema.TableName 
Select * from LinkedServer.RemoteServerDB.Schema.TableName with (nolock)





这应该可以解决问题。



您也可以在SSMS中尝试导入导出向导。



It should do the trick.

You can also try the Import Export Wizard in SSMS.