Linked Server Insert truncates string

  • Hello, when I try to insert data through linked server the data is truncated to 24 chars,

    INSERT [LINKEDSERVER].[DB].dbo.[Table1]

    ([Column1])

    VALUES('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') --30 char

    Column1 is varchar(max), SQL Server 2008 R2.

    Result is always truncated 24 char without error, any comments on this?

  • Edit. Removed as requested.

    -- Gianluca Sartori

  • Is there a way to delete old post?

  • No. If you want people to respond on this thread, add a link on the old one and I'll delete the duplicate post link above.

    -- Gianluca Sartori

  • I added a link to this post, can you remove dublicate post post?

  • I have to admit that I didn’t have such problem, so I’m not writing from experience, but if I’d run into this situation this would be the things that I’d check.

    First I’d check if the table has a trigger or instead of trigger that modifies the values that I’m inserting into it. If I won’t find it, I’d still check if the problem is only for this table. I would create a new table just for testing, and try to insert data into it with the linked server. If it would work, then I’ll try to see what is different with this specific table. If it doesn’t work and I’d still have truncated values, I’d try to rebuild the linked server with a different driver then the one that was originally used.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Hi I do think It can be related to driver, It is OLEDB provider for SQL Server, (the default when SQL Server is chosen).

    There is no trigger on table. I created a new table in the same db, result is same. What is interesting is when I create a new table having a "text" column there is no truncation. We had chosen varchar(max) because text is depreciated. Another interesting point is we have this issue only on this database, if I create the table in a new database again there is no truncation. Compatibility is 100.

    What bothers me is the truncation without warning. Months of data has been truncated and we saw it lately. Is this a bug?

  • Any update to this? I have the same problem, but it seems is localized to the server. I can repro it there, but it works perfectly on my workstation.

Viewing 8 posts - 1 through 7 (of 7 total)

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