2

i have two database MSSQL and MYSQL

i want to transfer data from MYSQL to MSSQL, in a result i made Linked Servers between them

I don't have any problem until this step

I wrote below code for fetch data from MYSQL and insert to MSSQL

INSERT into dbo.test2016
SELECT * FROM openquery(test1, 'SELECT t_id,t_date
FROM test1.test2016') T1
INNER JOIN dbo.test2016 T2 ON T1.t_date > T2.t_date

but I face Msg 213, Level 16, State 1, Line 1 in MSSQL because of INNER JOIN can't match with INSERT INTO

i need before insert to MSSQL, compare t_date column between two table

how can i do?

2
  • Consider exporting your data from MySQL to flat files and importing into SQL Server. Commented Jun 23, 2016 at 9:05
  • thanks for answer, but i made linked servers between these database that automatically this task do not manually Commented Jun 23, 2016 at 11:56

1 Answer 1

9

I know that this thread is old but I figured that I share an example that worked for me.

insert into openquery([LinkedServerName],'Select column1, column2 from mysqlDatabase.tableName' ) 
select column1, column2 from msServerTableName
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.