且构网

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

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

更新时间:2023-02-08 17:01:01

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的一个开始 http://blogs.msdn.com/ 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 http://blogs.msdn.com/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!