How can I copy data records between two instances of an SQLServer database(如何在 SQLServer 数据库的两个实例之间复制数据记录)
问题描述
我需要将一些记录从我们的 SQLServer 2005 测试服务器复制到我们的实时服务器.这是一个平面查找表,因此无需担心外键或其他参照完整性.
I need to copy some records from our SQLServer 2005 test server to our live server. It's a flat lookup table, so no foreign keys or other referential integrity to worry about.
我可以在实时服务器上再次键入记录,但这很烦人.我可以将测试服务器记录和表数据全部导出到 SQL 脚本中并运行它,但我不想覆盖实时系统上存在的记录,只添加到它们.
I could key-in the records again on the live server, but this is tiresome. I could export the test server records and table data in its entirety into an SQL script and run that, but I don't want to overwrite the records present on the live system, only add to them.
如何仅选择我想要的记录并将它们传输或以其他方式进入实时服务器?我们没有 Sharepoint,我知道这可以让我直接在两个实例之间复制它们.
How can I select just the records I want and get them transferred or otherwise into the live server? We don't have Sharepoint, which I understand would allow me to copy them directly between the two instances.
推荐答案
如果你的生产 SQL Server 和测试 SQL Server 可以通信,你可以使用 SQL insert 语句.
If your production SQL server and test SQL server can talk, you could just do in with a SQL insert statement.
首先在您的测试服务器上运行以下命令:
first run the following on your test server:
Execute sp_addlinkedserver PRODUCTION_SERVER_NAME
然后只需创建插入语句:
Then just create the insert statement:
INSERT INTO [PRODUCTION_SERVER_NAME].DATABASE_NAME.dbo.TABLE_NAME (Names_of_Columns_to_be_inserted)
SELECT Names_of_Columns_to_be_inserted
FROM TABLE_NAME
这篇关于如何在 SQLServer 数据库的两个实例之间复制数据记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 SQLServer 数据库的两个实例之间复制数据记录


- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 更改自动增量起始编号? 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- SQL 临时表问题 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01