String or binary data would be truncated while importing

  • Hi,

    I am Sql Server 2008 R2.

    I am using Openrowset command for importing sql table to excel file.

    My issue is,

    I have a column in sql table whose length of data is 263 characters, datatype assign is

    varchar(1000).

    But while importing to excel it gives me error ,

    String or binary data would be truncated.

    For checking purpose,I had imported my excel format file to sql,and checked the datatype of the mapped column,it is nvarchar(510).

    Please suggest me how to overcome this problem.

    Please help me I need this urgently.

    Thanks in Advance!!!!!

  • If and only if you are sure that you will never get data longer than you column width, you can stop the error message by using the option

    SET ANSI_WARNINGS OFF

    at the beginning of your code. This will surpress the error message.

    -------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
    There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
    I would never join a club that would allow me as a member - Groucho Marx

  • Some times it may contain large data in an Excel cell... but unable 2 see...

    Use =LEN(ParticularColumn) in another column of same Excel and drag for all records....U may able to find which row is more than 1000....(by using filter )

    Cross check once....

    If its still coming...check any merged cells are there.....

    Everthing is fine with data in Excel.an still getting error....take data with Dynamic SQL command with all columns with comma seperated and each record start with Select and end with UNION...

    Remove UNION for last record

    Which seems to be below...

    Select 'A','B','C' UNION

    Select 'X','23','X' UNION

    Select 'qw','dfg','ert'

    Excel Data :-

    A B C

    Z 23 X

    qw dfg ert

Viewing 3 posts - 1 through 2 (of 2 total)

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