SQL ServerMySQL查询(T-SQL)教程

本文介绍了如何在SQL Server中使用T-SQL与MySQL进行交互,包括创建MySQL链接服务器、通过ODBC数据源连接、插入、查询、更新和删除数据。文章详细阐述了使用T-SQL在SQL Server中操作MySQL数据库的方法,强调了数据一致性的维护。
摘要由CSDN通过智能技术生成

Microsoft SQL Server and MySQL, both are quite well-established database engines. In our role as a DBA, at some given time point we require T-SQL straddling between both database engines unites Select, Insert, Update, Delete and some other…

Microsoft SQL Server和MySQL都是非常完善的数据库引擎。 在作为DBA的角色中,在某些给定的时间点,我们需要两个数据库引擎之间的T-SQL跨越,将Select,Insert,Update,Delete和其他一些…

In terms of requirements for correlating with a MySQL database, eventually, we need to get to information from a MySQL database and synchronize it into Microsoft SQL Server. Now, a simple way to pursue that is with the utilization of MySQL connectors. The SQL Server statements or a query to insert, fetch or to do manipulations with the data from MySQL tables which are concerning to SQL Server tables. This means by inserting, fetching or manipulating in the solution we will have enough to import data from a MySQL Server database.

根据与MySQL数据库关联的要求,最终,我们需要从MySQL数据库获取信息并将其同步到Microsoft SQL Server中。 现在,一种简单的实现方法是利用MySQL连接器。 SQL Server语句或查询,用于对与SQL Server表有关MySQL表中的数据进行插入,提取或操作。 这意味着通过在解决方案中插入,获取或操作,我们将有足够的能力从MySQL Server数据库导入数据。

Now before dealing with T-SQL for MySQL inside the SQL Server, the Connection needs to be set up within inter-related Server as an initial step to start with. Additionally, the MySQL ODBC driver needs to be preinstalled on the machine.

现在,在处理SQL Server中用于MySQL的T-SQL之前,首先需要在相互关联的Server中建立连接。 此外,需要在计算机上预安装MySQL ODBC驱动程序。

创建一个MySQL链接服务器 (Create a MySQL Linked Server)

Let’s start with establishing an ODBC data source to the MySQL Server on the machine on which the SQL Server is installed.

让我们从在安装SQL Server的计算机上为MySQL Server建立ODBC数据源开始。

打开ODBC数据源 (Open ODBC Data Sources)

To add new source, click the Add button, select the MySQL ODBC 8.0 ANSI Driver to integrate MySQL connection and click the Finish button.

要添加新源,请单击“ 添加”按钮,选择“ MySQL ODBC 8.0 ANSI驱动程序”以集成MySQL连接,然后单击“ 完成”按钮。

Adding ODBC Connection where SQL SERVER is installed

Subsequently, configure the required information in MySQL Connector window to configure MySQL Data Source Name. In this example, we have used the localhost as the MySQL server name. Now, we can verify the connection with tapping on Test button. upon the successful test, the data source would be available to include another MySQL Linked Server in SQL Server illustration.

随后,在“ MySQL连接器”窗口中配置所需的信息以配置MySQL数据源名称 。 在此示例中,我们使用localhost作为MySQL服务器名称。 现在,我们可以点击“ 测试”按钮来验证连接。 测试成功后,数据源将可用于在SQL Server插图中包括另

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值