I have a table with
ID INT(16)
StateName VARCHAR(50)
Details MEDIUMTEXT
When I do an insert over the linked server connection:
Insert Into MySQL...tblState (ID, StateName, Details) Values (1,'Alabama','Test')
The row ID is set to 0 instead of 1.
If I flip the table structure to put the Details before the Statename, so that the MEDIUMTEXT is not the last column, and do the same insert statement.
Insert Into MySQL...tblState (ID, Details, StateName) Values (1,'Test','Alabama')
Then the insert works exactly like it's supposed to.
Is this a known bug, or is there a setting that I need to change to fix this?
I'm using the MySQL ODBC 5.1 Driver
Edit: In case this helps anyone, here are the results of a test I did.
In phpmyadmin:
CREATE TABLE `tblState` (
`StateID` int(11) NOT NULL,
`State` varchar(50) NOT NULL,
`Details` mediumtext NOT NULL,
PRIMARY KEY (`StateID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE `tblState2` (
`StateID` int(11) NOT NULL,
`Details` mediumtext NOT NULL,
`State` varchar(50) NOT NULL,
PRIMARY KEY (`StateID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
From SQL Server over linked server:
insert into mysql...tblState(StateID,State,Details) values (1,'alabama','test1')
(1 row(s) affected)
select * from mysql...tblState
StateID State Details
----------- -------------------- --------------------
0 alabama test1
(1 row(s) affected)
insert into mysql...tblState2(StateID,Details,State) values (1,'test2','alabama' )
(1 row(s) affected)
select * from mysql...tblState2
StateID Details State
----------- -------------------- --------------------
1 test2 alabama
(1 row(s) affected)