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

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

问题描述

使用 C# (vs2005) 我需要将表从一个数据库复制到另一个数据库.两个数据库引擎都是 SQL Server 2005.对于远程数据库,源,我只有对存储过程的执行访问权限来获取我需要在本地带来的数据.

Using C# (vs2005) I need to copy a table from one database to another. Both database engines are SQL Server 2005. For the remote database, the source, I only have execute access to a 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 columns. 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)

示例文章

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

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