Mismatch or data overflow on MySQL Link Server

  • I try to Insert some records to my remote MySql from my SQL Server.
    The MySql is connected as Link server.

    The script I run is,

    INSERT INTO OPENQUERY(LINKSERVER1,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, ERPCode from rszcf_virtuemart_categories_el_gr')
    (virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode)
    SELECT AA1, Category_Name1, Category_Description1, Metadesc1, Metakey1, CustomTitle1, slug1, ERPCode1 FROM EGM_WEB_Categories_el_gr T1
    WHERE NOT EXISTS
    (
      SELECT 1
      FROM OPENQUERY(LINKSERVER1,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode from rszcf_virtuemart_categories_el_gr') T2 WHERE
      T2.erpcode = t1.ERPCode1 collate Greek_CI_AI
    )

    and always I get the error

    The OLE DB provider "MSDASQL" for linked server "LINKSERVER1" could not INSERT INTO table "[MSDASQL]" because of column "category_description".
    Could not convert the data value due to reasons other than sign mismatch or overflow.

    In the Mysql the category_description field  is VARCHAR(19000) and in the SQL SERVER is nvarchar(255)

    How I can pass this error?
    Any help?

  • makis_best - Thursday, June 7, 2018 3:20 AM

    I try to Insert some records to my remote MySql from my SQL Server.
    The MySql is connected as Link server.

    The script I run is,

    INSERT INTO OPENQUERY(LINKSERVER1,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, ERPCode from rszcf_virtuemart_categories_el_gr')
    (virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode)
    SELECT AA1, Category_Name1, CAST(Category_Description1 AS text) AS Category_Description1, Metadesc1, Metakey1, CustomTitle1, slug1, ERPCode1 FROM EGM_WEB_Categories_el_gr T1
    WHERE NOT EXISTS
    (
      SELECT 1
      FROM OPENQUERY(LINKSERVER1,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode from rszcf_virtuemart_categories_el_gr') T2 WHERE
      T2.erpcode = t1.ERPCode1 collate Greek_CI_AI
    )

    and always I get the error

    The OLE DB provider "MSDASQL" for linked server "LINKSERVER1" could not INSERT INTO table "[MSDASQL]" because of column "category_description".
    Could not convert the data value due to reasons other than sign mismatch or overflow.

    How I can pass this error?
    Any help?

    So you're not going to tell us the datatype of category_description, yet you still expect a useful answer? 🙂

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Phil Parkin - Thursday, June 7, 2018 5:12 AM

    makis_best - Thursday, June 7, 2018 3:20 AM

    I try to Insert some records to my remote MySql from my SQL Server.
    The MySql is connected as Link server.

    The script I run is,

    INSERT INTO OPENQUERY(LINKSERVER1,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, ERPCode from rszcf_virtuemart_categories_el_gr')
    (virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode)
    SELECT AA1, Category_Name1, CAST(Category_Description1 AS text) AS Category_Description1, Metadesc1, Metakey1, CustomTitle1, slug1, ERPCode1 FROM EGM_WEB_Categories_el_gr T1
    WHERE NOT EXISTS
    (
      SELECT 1
      FROM OPENQUERY(LINKSERVER1,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode from rszcf_virtuemart_categories_el_gr') T2 WHERE
      T2.erpcode = t1.ERPCode1 collate Greek_CI_AI
    )

    and always I get the error

    The OLE DB provider "MSDASQL" for linked server "LINKSERVER1" could not INSERT INTO table "[MSDASQL]" because of column "category_description".
    Could not convert the data value due to reasons other than sign mismatch or overflow.

    How I can pass this error?
    Any help?

    So you're not going to tell us the datatype of category_description, yet you still expect a useful answer? 🙂

    I am so sorry....  you right...  I forget it
    In the Mysql the category_description field is VARCHAR(19000) and in the SQL SERVER is nvarchar(255)

  • OK, try this version:

    INSERT INTO OPENQUERY
        (LINKSERVER1
        ,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, ERPCode from rszcf_virtuemart_categories_el_gr'
        )
    (
      virtuemart_category_id
    , category_name
    , category_description
    , metadesc
    , metakey
    , CustomTitle
    , slug
    , erpcode
    )
    SELECT
      AA1
    ,  Category_Name1
    ,  Category_Description1 = CAST(Category_Description1 AS VARCHAR(255))
    ,  Metadesc1
    ,  Metakey1
    ,  CustomTitle1
    ,  slug1
    ,  ERPCode1
    FROM EGM_WEB_Categories_el_gr T1
    WHERE
      NOT EXISTS
    (
      SELECT 1
      FROM
        OPENQUERY
        (LINKSERVER1
        ,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode from rszcf_virtuemart_categories_el_gr'
        ) T2
      WHERE T2.erpcode = t1.ERPCode1 COLLATE Greek_CI_AI
    );

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Thank you for your reply Phil Parkin.
    I just try your version but I keep getting the same error.

  • makis_best - Thursday, June 7, 2018 2:29 PM

    Thank you for your reply Phil Parkin.
    I just try your version but I keep getting the same error.

    Phil Parkin - Thursday, June 7, 2018 6:28 AM

    OK, try this version:

    INSERT INTO OPENQUERY
        (LINKSERVER1
        ,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, ERPCode from rszcf_virtuemart_categories_el_gr'
        )
    (
      virtuemart_category_id
    , category_name
    , category_description
    , metadesc
    , metakey
    , CustomTitle
    , slug
    , erpcode
    )
    SELECT
      AA1
    ,  Category_Name1
    ,  Category_Description1 = CAST(Category_Description1 AS VARCHAR(255))
    ,  Metadesc1
    ,  Metakey1
    ,  CustomTitle1
    ,  slug1
    ,  ERPCode1
    FROM EGM_WEB_Categories_el_gr T1
    WHERE
      NOT EXISTS
    (
      SELECT 1
      FROM
        OPENQUERY
        (LINKSERVER1
        ,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode from rszcf_virtuemart_categories_el_gr'
        ) T2
      WHERE T2.erpcode = t1.ERPCode1 COLLATE Greek_CI_AI
    );

    The same....  Nothing changed....
    I Get the same error.

  • I gave you my best guess, but I don't know much about MySQL, so I think you need help from others.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Phil Parkin - Friday, June 8, 2018 5:32 AM

    I gave you my best guess, but I don't know much about MySQL, so I think you need help from others.

    I appreciate you help...
    I keep searching what is going on...   Probably it is a bug.

  • makis_best - Thursday, June 7, 2018 3:20 AM

    I try to Insert some records to my remote MySql from my SQL Server.
    The MySql is connected as Link server.

    The script I run is,

    INSERT INTO OPENQUERY(LINKSERVER1,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, ERPCode from rszcf_virtuemart_categories_el_gr')
    (virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode)
    SELECT AA1, Category_Name1, Category_Description1, Metadesc1, Metakey1, CustomTitle1, slug1, ERPCode1 FROM EGM_WEB_Categories_el_gr T1
    WHERE NOT EXISTS
    (
      SELECT 1
      FROM OPENQUERY(LINKSERVER1,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode from rszcf_virtuemart_categories_el_gr') T2 WHERE
      T2.erpcode = t1.ERPCode1 collate Greek_CI_AI
    )

    and always I get the error

    The OLE DB provider "MSDASQL" for linked server "LINKSERVER1" could not INSERT INTO table "[MSDASQL]" because of column "category_description".
    Could not convert the data value due to reasons other than sign mismatch or overflow.

    In the Mysql the category_description field  is VARCHAR(19000) and in the SQL SERVER is nvarchar(255)

    How I can pass this error?
    Any help?

    Well, not necessarily a bug. But stop and think about how you code an insert. Normal INSERT syntax is likely rather similar between MySQL and SQL Server, so why wouldn't you just do something like this:

    INSERT INTO LINKSERVER1..rszcf_virtuemart_categories_el_gr (virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode)
    SELECT
      AA1,
      Category_Name1,
      CAST(Category_Description1 AS text) AS Category_Description1,
      Metadesc1,
      Metakey1,
      CustomTitle1,
      slug1,
      ERPCode1
    FROM EGM_WEB_Categories_el_gr AS T1
    WHERE NOT EXISTS
      (
      SELECT 1
      FROM OPENQUERY(LINKSERVER1, '
       select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode
       from rszcf_virtuemart_categories_el_gr
       ') AS T2
      WHERE T2.erpcode = t1.ERPCode1 COLLATE Greek_CI_AI
      );

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • sgmunson - Friday, June 8, 2018 12:02 PM

    makis_best - Thursday, June 7, 2018 3:20 AM

    I try to Insert some records to my remote MySql from my SQL Server.
    The MySql is connected as Link server.

    The script I run is,

    INSERT INTO OPENQUERY(LINKSERVER1,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, ERPCode from rszcf_virtuemart_categories_el_gr')
    (virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode)
    SELECT AA1, Category_Name1, Category_Description1, Metadesc1, Metakey1, CustomTitle1, slug1, ERPCode1 FROM EGM_WEB_Categories_el_gr T1
    WHERE NOT EXISTS
    (
      SELECT 1
      FROM OPENQUERY(LINKSERVER1,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode from rszcf_virtuemart_categories_el_gr') T2 WHERE
      T2.erpcode = t1.ERPCode1 collate Greek_CI_AI
    )

    and always I get the error

    The OLE DB provider "MSDASQL" for linked server "LINKSERVER1" could not INSERT INTO table "[MSDASQL]" because of column "category_description".
    Could not convert the data value due to reasons other than sign mismatch or overflow.

    In the Mysql the category_description field  is VARCHAR(19000) and in the SQL SERVER is nvarchar(255)

    How I can pass this error?
    Any help?

    Well, not necessarily a bug. But stop and think about how you code an insert. Normal INSERT syntax is likely rather similar between MySQL and SQL Server, so why wouldn't you just do something like this:

    INSERT INTO LINKSERVER1..rszcf_virtuemart_categories_el_gr (virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode)
    SELECT
      AA1,
      Category_Name1,
      CAST(Category_Description1 AS text) AS Category_Description1,
      Metadesc1,
      Metakey1,
      CustomTitle1,
      slug1,
      ERPCode1
    FROM EGM_WEB_Categories_el_gr AS T1
    WHERE NOT EXISTS
      (
      SELECT 1
      FROM OPENQUERY(LINKSERVER1, '
       select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode
       from rszcf_virtuemart_categories_el_gr
       ') AS T2
      WHERE T2.erpcode = t1.ERPCode1 COLLATE Greek_CI_AI
      );

    I can't do that...
    SQL Server producer doesn't recognize the syntax of the insert....
    The insert command is inside procedure of sql server.

  • makis_best - Saturday, June 9, 2018 1:16 AM

    sgmunson - Friday, June 8, 2018 12:02 PM

    makis_best - Thursday, June 7, 2018 3:20 AM

    I try to Insert some records to my remote MySql from my SQL Server.
    The MySql is connected as Link server.

    The script I run is,

    INSERT INTO OPENQUERY(LINKSERVER1,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, ERPCode from rszcf_virtuemart_categories_el_gr')
    (virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode)
    SELECT AA1, Category_Name1, Category_Description1, Metadesc1, Metakey1, CustomTitle1, slug1, ERPCode1 FROM EGM_WEB_Categories_el_gr T1
    WHERE NOT EXISTS
    (
      SELECT 1
      FROM OPENQUERY(LINKSERVER1,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode from rszcf_virtuemart_categories_el_gr') T2 WHERE
      T2.erpcode = t1.ERPCode1 collate Greek_CI_AI
    )

    and always I get the error

    The OLE DB provider "MSDASQL" for linked server "LINKSERVER1" could not INSERT INTO table "[MSDASQL]" because of column "category_description".
    Could not convert the data value due to reasons other than sign mismatch or overflow.

    In the Mysql the category_description field  is VARCHAR(19000) and in the SQL SERVER is nvarchar(255)

    How I can pass this error?
    Any help?

    Well, not necessarily a bug. But stop and think about how you code an insert. Normal INSERT syntax is likely rather similar between MySQL and SQL Server, so why wouldn't you just do something like this:

    INSERT INTO LINKSERVER1..rszcf_virtuemart_categories_el_gr (virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode)
    SELECT
      AA1,
      Category_Name1,
      CAST(Category_Description1 AS text) AS Category_Description1,
      Metadesc1,
      Metakey1,
      CustomTitle1,
      slug1,
      ERPCode1
    FROM EGM_WEB_Categories_el_gr AS T1
    WHERE NOT EXISTS
      (
      SELECT 1
      FROM OPENQUERY(LINKSERVER1, '
       select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode
       from rszcf_virtuemart_categories_el_gr
       ') AS T2
      WHERE T2.erpcode = t1.ERPCode1 COLLATE Greek_CI_AI
      );

    I can't do that...
    SQL Server producer doesn't recognize the syntax of the insert....
    The insert command is inside procedure of sql server.

    Does your MySQL instance have a database name and/or schema name for the table you are referencing?   When I used the double-dot notation, it was to skip over the database name and schema name, so it may just be a matter of supplying those values instead of just the double dots.  e.g.:
    LINKEDSERVER1.DatabaseName.SchemaName.rszcf_virtuemart_categories_el_gr

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • sgmunson - Monday, June 11, 2018 6:16 AM

    makis_best - Saturday, June 9, 2018 1:16 AM

    sgmunson - Friday, June 8, 2018 12:02 PM

    makis_best - Thursday, June 7, 2018 3:20 AM

    I try to Insert some records to my remote MySql from my SQL Server.
    The MySql is connected as Link server.

    The script I run is,

    INSERT INTO OPENQUERY(LINKSERVER1,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, ERPCode from rszcf_virtuemart_categories_el_gr')
    (virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode)
    SELECT AA1, Category_Name1, Category_Description1, Metadesc1, Metakey1, CustomTitle1, slug1, ERPCode1 FROM EGM_WEB_Categories_el_gr T1
    WHERE NOT EXISTS
    (
      SELECT 1
      FROM OPENQUERY(LINKSERVER1,'select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode from rszcf_virtuemart_categories_el_gr') T2 WHERE
      T2.erpcode = t1.ERPCode1 collate Greek_CI_AI
    )

    and always I get the error

    The OLE DB provider "MSDASQL" for linked server "LINKSERVER1" could not INSERT INTO table "[MSDASQL]" because of column "category_description".
    Could not convert the data value due to reasons other than sign mismatch or overflow.

    In the Mysql the category_description field  is VARCHAR(19000) and in the SQL SERVER is nvarchar(255)

    How I can pass this error?
    Any help?

    Well, not necessarily a bug. But stop and think about how you code an insert. Normal INSERT syntax is likely rather similar between MySQL and SQL Server, so why wouldn't you just do something like this:

    INSERT INTO LINKSERVER1..rszcf_virtuemart_categories_el_gr (virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode)
    SELECT
      AA1,
      Category_Name1,
      CAST(Category_Description1 AS text) AS Category_Description1,
      Metadesc1,
      Metakey1,
      CustomTitle1,
      slug1,
      ERPCode1
    FROM EGM_WEB_Categories_el_gr AS T1
    WHERE NOT EXISTS
      (
      SELECT 1
      FROM OPENQUERY(LINKSERVER1, '
       select virtuemart_category_id, category_name, category_description, metadesc, metakey, CustomTitle, slug, erpcode
       from rszcf_virtuemart_categories_el_gr
       ') AS T2
      WHERE T2.erpcode = t1.ERPCode1 COLLATE Greek_CI_AI
      );

    I can't do that...
    SQL Server producer doesn't recognize the syntax of the insert....
    The insert command is inside procedure of sql server.

    Does your MySQL instance have a database name and/or schema name for the table you are referencing?   When I used the double-dot notation, it was to skip over the database name and schema name, so it may just be a matter of supplying those values instead of just the double dots.  e.g.:
    LINKEDSERVER1.DatabaseName.SchemaName.rszcf_virtuemart_categories_el_gr

    I try that way too....  But nothing change
    I am keep searching for the reason that happen

  • So many days trying and experiment lot of things... but nothing....
    Any other help?

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply