简体   繁体   English

从MySQL到MS SQL Server…需要有关最佳方法的建议

[英]MySQL to MS SQL Server…need advice on best approach

I'm importing data from a remote MySQL server. 我正在从远程MySQL服务器导入数据。 I'm connecting to the MySQL database through a SSH connection and then pulling the data into MS SQL Server. 我正在通过SSH连接连接到MySQL数据库,然后将数据拉入MS SQL Server。 There are a couple of type checks that need to be performed, especially the MySQL DateTime to the MS SQL DateTime. 有几个类型检查需要执行,尤其是MySQL DateTime到MS SQL DateTime。 Initially I thought about using the MySqlDataReader to read the data into a List<T> to ensure correct types and then pushing the data into a DataSet and then into MS SQL Server. 最初,我考虑过使用MySqlDataReader将数据读取到List<T>以确保类型正确,然后将数据推送到DataSet中,然后再推送到MS SQL Server中。

Is this a good approach or should I be looking into doing this a different way? 这是一个好方法还是我应该考虑以其他方式进行此操作? I can certainly do a bulk insert into SQL Server but then I'll have to deal with the data types later. 我当然可以在SQL Server中进行批量插入,但是稍后我将不得不处理数据类型。

Thoughts? 有什么想法吗?

I personally wouldn't use a dataset in the process, but moving it into a .NET type, then using a parameterized SQL statement will work just fine. 我个人不会在此过程中使用数据集,但是将其移动到.NET类型,然后使用参数化的SQL语句就可以了。

If you have a very large set, you might think of looking at a bulk insert, but that will depend on the size of the set. 如果您有一个非常大的集合,则可能会考虑查看批量插入,但这取决于集合的大小。

Here's a Microsoft Guideline for going from MySQL to Sql Server 2000: 这是从MySQL到Sql Server 2000的Microsoft指南:

http://technet.microsoft.com/en-us/library/cc966396.aspx http://technet.microsoft.com/zh-CN/library/cc966396.aspx

SQL Server has a rich set of tools and utilities to ease the migration from MySQL. SQL Server具有丰富的工具和实用程序集,可简化从MySQL的迁移。 SQL Server 2000 Data Transformation Services (DTS) is a set of graphical tools and programmable objects for extraction, transformation, and consolidation of data from disparate sources into single or multiple destinations. SQL Server 2000数据转换服务(DTS)是一组图形工具和可编程对象,用于将数据从不同的源提取,转换和合并到单个或多个目标中。

From reading this article you can import your MySQL without writing a line of C# 通过阅读本文,您无需编写C#行即可导入MySQL。

The easiest way to do it to convert it to Timestamp. 将其转换为时间戳的最简单方法。

Timestamp SetupStart_ts = rs.getTimestamp("SetupStart");
String SetupStart = SetupStart_ts.toString()

Push it to mssql server straightaway and it will save automatically in the datetime but varify it.Thank you. 直接将其推送到mssql服务器,它将在日期时间自动保存,但会更改它。谢谢。

You know, if it's a process you need to perform but you aren't limited to writing your own code, you might want to look at Talend. 您知道,如果这是您需要执行的过程,但不仅限于编写自己的代码,您可能想看看Talend。 It's an open source tool for ETL (essentially data transforms between data sources). 它是ETL(实际上是数据源之间的数据转换)的开源工具。

It's open source and has a nice GUI for designing the transform - where things come from and where they go to, plus what happens in the middle. 它是开源的,并且具有用于设计转换的漂亮GUI-事物的来源和去向,以及中间发生的事情。

http://www.talend.com/index.php http://www.talend.com/index.php

Just a thought, but if you're just trying to reach a goal as opposed to write the tool, it may be quicker and more flexible in the long run for you. 只是一个想法,但是如果您只是想实现一个目标而不是编写该工具,那么从长远来看,它可能会更快,更灵活。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM