data truncation

  • i have a bug that appears only with some programs builds & not others. my bindparameter stmt incorrectly specified the length of a char col. as 16 bytes when in the DB it's actually 4 bytes.  i supply a lib of SQL fucntions for use by other programmers.  when i build a test pgm i get the error:

     [Microsoft][ODBC SQL Server Driver][SQL Server]String or binary data would be truncated.

    as i would expect yet when this lib is built into other apps that run in our production environment the error does not appear.

    i have .net installed whereas the other developers do not. could this be the source of the problem? 

  • This was removed by the editor as SPAM

  • Just a thought...

    Since this is a CHAR datatype, make sure you are not trying to spaces...

    An easy oversite on the app end is to not TRIM trailing spaces before letting users enter data. e.g. If the data already existed as "    ". And it wasn't trimmed before letting users edit it, it could end up like "Data    " when it's returned to the server.

    Also, if users are manually entering data for this field, use VARCHAR. If using a lookup table, check there.


    Enjoy!

    A Brown

    Manage all of your backups in one simple job using this script.

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

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