Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1100
  • Last Modified:

What does this error mean " string data, Length mismatch"

What does " string data, Length mismatch" mean I keep getting it when I am trying to upload product to my database.

1 Solution
That's not a very descriptive error...  You may be trying to add a record that is too long for the column in the database?  
If the column "first_name" is defined as [varchar] (50) and you enter a value that is 55 characters long, it will error but usually the error will be "truncating string"... or something to that effect.


are you trying to add a string with a '

if so, sql server can't handle the '

you need to: REPLACE(string,"'","''")

and make ' into ''

For instance, inserting the string: Donut's
will fail.  But
inserting the string: Donut''s
will be fine.

Also, if that is not the problem...
try turning quoted_identifier ON, which allows query analyzer / stored procs to have '" + + "' (code like string concatenation)...

lemme know if this helps,, and try being more descriptive, like: what is the string you are inserting, to what data type of column in the database.. that sort of stuff..

Hello BoostDriven,
   My first guess would be that the column you're inserting to is a char field.  In which case, you'll have to trim or truncate the data to fit in column.
    If that doesn't solutions don't solve the problem, please explain the context of this error message.  What is the datatype for the column you are inserting into?
   Also, how are you trying to upload data?  With individual insert statements?  From an Access query or table?  Using a data transformation service(DTS)?
   The best of luck to you.

This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.  

I will leave the following recommendation for this question in the Cleanup topic area:

Accept Answer From tolstoyleo

Any objections should be posted here in the
next 4 days. After that time, the question will be closed.

EE Cleanup Volunteer

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now