从一个数据库表复制到另一个C# [英] Copy from one database table to another C#

查看:326
本文介绍了从一个数据库表复制到另一个C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用C#(VS2005),我需要从一个数据库复制表到另一个。这两个数据库引擎是MS SQL 2005中的远程数据库,源,我只有执行访问一个存储过程(存储过程)来获取我需要将本地数据。

Using C# (vs2005) I need to copy a table from one database to another. Both database engines are MS SQL 2005. For the remote database, the source, I only have execute access to a sproc (stored procedure) to get the data I need to bring locally.

本地数据库中,我有更多的控制权,因为它是被[asp.net]应用程序,它需要这个远程表的本地副本。我们希望这地方更容易查找并加入与其他表等。

The local database I have more control over as it's used by the [asp.net] application which needs a local copy of this remote table. We would like it local for easier lookup and joins with other tables, etc.

你能向我解释这个数据复制到本地数据库的有效方法。

Could you please explain to me an efficient method of copying this data to our local database.

局部表可以与同一个模式作为远程之一创建,如果它使事情变得更简单。远程表有9列,其中没有一个是标识字段。大约有远程表中的5400行,这个数字大约200年的增长。所以不是一个快速变化的表。

The local table can be created with the same schema as the remote one, if it makes things simpler. The remote table has 9 columns, none of which are identity fields. There are approximately 5400 rows in the remote table, and this number grows by about 200 a year. So not a quickly changing table.

推荐答案

ADO.NET的批量复制功能,可以帮助你看看是:

Bulk Copy feature of ADO.NET might help you take a look at that :

MSDN - 多个大容量复制操作(ADO.NET)

<一个href="http://www.c-sharpcorner.com/UploadFile/mahesh/BulckCopyAdoNet2008192005135138PM/BulckCopyAdoNet20.aspx">An例如文章

这篇关于从一个数据库表复制到另一个C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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