T-SQL MERGE and OPENQUERY
Hi folks,
I am currently merging an MySql database table to an SQL Server database table. To access the MySql table I do use uses the OPENQUERY command. Getting the rows with OPENQUERY works fine so far. Inserting also with the following query:
INSERT INTO serverData (online, recorded, id, server)
SELECT [online], [recorded], [id], [server] FROM OPENQUERY(MYSQL, 'SELECT * FROM servercheck')
This has to be automatized. I want to update the the table serverData (which is in my SQL 2008 Server) with the results from the OPENQUERY. The table has to contain no duplicate rows.
I tried the merge statement a few times but it gives me an Incorrect syntax near the keyword 'INTO'.
Has anyone a solution?
|