从.sql脚本将数据附加到现有SQL数据库

编程入门 行业动态 更新时间:2024-10-24 04:50:43
本文介绍了从.sql脚本将数据附加到现有SQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在编写一个需要使用用户提供的指纹,图片和其他数据进行用户注册的应用程序。这是为了拥有它的数据库,并将安装在许多计算机上。另一个应用程序,主要应用程序,完成其余的工作。现在,我想从注册应用程序中作为备份生成的.sql脚本中的任何计算机将数据从注册数据库传输到主应用程序数据库。所以我的问题是,我该怎么做,因为如果我尝试正常恢复,它会覆盖数据库中的现有数据。我需要一些帮助。

I''m writting an application that requires user registration using fingerprints, pictures and other data supplied by the user. This is to hav its database and would be installed on many computers. And another application, the main application that does the rest of the work. Now i want to transfer the data from the registration database to the main application database from any of the computers from a .sql script produced as backup from the registration apps. So my question is, how would i do this, because if i try normal restore, it overwrites the existing data in the database. Please i need some help.

推荐答案

Emejulu, 您的问题需要更多解释。他们有什么SQL服务器版本?注册数据库中的表是否与主数据库的布局相同?,您是否想要一个自动作业,每晚从一个数据库唤醒并将数据复制到另一个数据库? 你想使用一个SSIS包?你想使用shell脚本来复制数据吗?您可以使用bcp将数据提取到文本文件,然后使用bcp将数据导入主db。有很多方法可以将数据从一个数据库传输到另一个数据库。 cocis。 Emejulu, Your question requires a lot more explanation. What SQL server version do they have? Are the tables from the registration database the same layout as the Main database?, do you want a automatic job that wakes up and copy data every night from one db to another? do you want to use a SSIS package? do you want to use a shell script to copy the data? you can use bcp to extract data to a text file and bcp to import it at the main db. There are many ways to transfer data from one db to another. cocis.

我认为你更善于使用在这种情况下SMO,你以某种方式保存转移条目的最后 日期/时间或另一个有助于下次经理点击转移按钮的字段。这是smo API的一个开始 blogs.msdn/ b / olivier_pieri / archive / 2004/12/06 / 275825.aspx [ ^ ] 示例显示如何连接到SQL,然后从那里访问注册数据库中的表并写入主数据库上的数据。 您可以阅读更多信息或从Microsoft获得更多SMO样本。 祝您好运! I my opinion you are better of using SMO in that case, you somehow save the last date/time of the entries transfered or another field that help for the next time that the manager click on the transfer button. Here is a start on the smo API blogs.msdn/b/olivier_pieri/archive/2004/12/06/275825.aspx[^] the sample show just how to connect to SQL, then go from there accessing the tables from the registration db and write the data on the main db. You can read more or get more SMO samples from Microsoft. Good Luck!

更多推荐

从.sql脚本将数据附加到现有SQL数据库

本文发布于:2023-11-10 01:02:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573933.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:脚本   数据库   数据   sql   SQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!