sql仅在表存在的情况下从第一个数据库更新第二个数据库中的数据 [英] sql update data in 2nd db from 1st db only where table exists

查看:56
本文介绍了sql仅在表存在的情况下从第一个数据库更新第二个数据库中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一些表从实时数据库移动到另一个数据库,然后在传输数据后将其变为实时数据库.第二个数据库存在于 2008 年的服务器上,迁移是从 2012 年开始的.这造成了一些问题

I'm trying to move some tables from a live db to another db, which will then be made live after the data has been transferred. The 2nd db exists on a server with 2008, and the migration is from 2012. which has caused a few problems

最初我用脚本做了一个完整的数据库导出.因为导出工具不会转到以前的版本.- 完全导出后,我删除了 db2 上多余的表.因为我只移动了大约 200 个中的 40 个左右.

Originally I did a full DB export with Scripts. because the export tool wouldnt go to previous versions. - after the full export I deleted the superfluous tables on db2. as I am only moving 40 or so out of about 200.

现在数据库结构已经建立,一切正常.过时的数据.一旦数据更新,一切都准备好进行切换.所以我理想地喜欢一个脚本来检查 db1 中的表是否存在于 db2 中,然后如果它在所有行之间进行复制.这可能吗?

Now the DB structure is set up, all is working. with out of date-data. and everything is ready to be switched once the data is made up to date. So i'd ideally like a script that checks to see if a table in db1 exists in db2, then if it does to copy across all rows. Is this possible?

推荐答案

如果创建链接服务器不是一种选择,那么您可以尝试使用 sql server 导入数据向导将数据从一个数据库传输到另一个数据库.使用以下链接了解操作方法:在sql server中轻松导入数据

If creating a linked server is not an option then you can try using sql server import data wizard to transfer data from one db to another. Use the following link for how-to: Import data easily in sql server

这篇关于sql仅在表存在的情况下从第一个数据库更新第二个数据库中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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