I'm trying to run a delete query from Micrsoft SQL server to clear out a table in a remote mySQL table.
Query is:
delete from OPENQUERY(WEB_DB,'select id,university_name,college_name from table_name');
This is returning the error:
OLE DB provider "MSDASQL" for linked server "WEB_DB" returned message "Key column information is insufficient or incorrect. Too many rows were affected by update.". Msg 7345, Level 16, State 1, Line 1 The OLE DB provider "MSDASQL" for linked server "WEB_DB" could not delete from table "select id,university_name,college_name from table_name". Updating did not meet the schema requirements.
The SQL used to create the table is as follows:
CREATE TABLE IF NOT EXISTS `table_name` (
`pk` int(11) AUTO_INCREMENT,
`studentid` int(11) default NULL,
`university_name` varchar(255) default NULL,
`college_name` varchar(255) default NULL,
CONSTRAINT PRIMARY KEY(`pk`)
);
Interestingly it does appear to do delete some portion of the remote database records, there should be ~900, running the delete command for the first time reduces this to ~700 so it seems like the limit is about 200 rows?!
Any help much appreciated.
Thanks Jona