Can't insert into linked MySQL server

ohtdti5x  于 2023-08-02  发布在  Mysql
关注(0)|答案(1)|浏览(96)

I want to insert a new rows into database in MySQL server from SQL Server Management Studio. To make it possible I've created a linked server in SMSS with this guide: https://www.sqlshack.com/how-to-create-and-configure-a-linked-server-to-connect-to-mysql-in-sql-server-management-studio/ . I'm using next:

  • Microsoft SQL Server 2022,
  • MySQL Server 5.8,
  • SQL Server Management Studio 2019,
  • MySQL Server Workbench 8.0.

I was trying to do:

INSERT INTO [MYSQL]...[cclog_db].[companies] (id, company_code, name)
VALUES (5, 5 , 'Random Company');

Where "MYSQL" is a name of a linked server, "testdb" is a name of DB in MySQL Server, "companies" is a name of a table. As a result I got next:

Msg 117, Level 15, State 1, Line 1 The name 'MYSQL...cclog_db.companies' exceeds the maximum number of prefixes. The maximum number is 3.。

Completion time: 2023-07-12T09:29:59.3909575+09:00

Is there is a way to insert new rows to MySQl server from SQL Server? Also is there is a way to copy data from the same table in SQL Server to MySql server?

mhd8tkvw

mhd8tkvw1#

This error means that mysql columns can't store so many characters. varchar is recommended. You can turn it up, for example, from varchar (50) to Varchar (200).

相关问题