Iām looking for some help in being able to query the data in SuiteCRMās MySql database via a linked server in MS Sql Server. The reason for the odd request is that once in MSSQL we can then build SSRS reports which plug direct into a SharePoint server.
I have it working but some of the queries return an error in MSSQL and itās due to the datatypes used in MySQL. Here is an example of the error when I do a query on the Account table:-
SELECT id, name, CONVERT(datetime, date_entered) AS date_entered, CONVERT(datetime, date_modified) AS date_modified, modified_user_id, created_by, description, deleted, assigned_user_id, account_type, industry,
annual_revenue, phone_fax, billing_address_street, billing_address_city, billing_address_state, billing_address_postalcode, billing_address_country, rating, phone_office, phone_alternate, website, ownership,
employees, ticker_symbol, shipping_address_street, shipping_address_city, shipping_address_state, shipping_address_postalcode, shipping_address_country, parent_id, sic_code, campaign_id
FROM OPENQUERY(SUITECRM, āSELECT * FROM accountsā) AS Accounts_1
We have to convert the date into an SQL datetime but that all works. Iāve found that this returns the follow error:
Msg 7347, Level 16, State 1, Line 2
OLE DB provider āMSDASQLā for linked server āSUITECRMā returned data that does not match expected data length for column ā[MSDASQL].parent_idā. The (maximum) expected data length is 72, while the returned data length is 0.
The fault lies in the column types that are āchar(36)ā. If you alter the type to āvarchar(36)ā the problem goes away and everything works. I obviously donāt want to go and change all the CHAR types to VARCHAR, so there must be a way to handle the error.
Any help would be appreciated.
Thanks,
Ian