?
Solved

data truncated

Posted on 2000-03-20
7
Medium Priority
?
784 Views
Last Modified: 2013-11-20
I have an odbc application which retrieves and transfers data from and to big databases (3000 records).
The problem is that I always get the message "data truncated".
Is this because of the big size of the databases?
what could be the reason for this and how can I solve that problem?
0
Comment
Question by:twg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 1

Accepted Solution

by:
Deckmeister earned 90 total points
ID: 2639013
No, this message "data truncated" is not because of the size of the databases. And in fact, 3000 records is not very big (there exist many databases with far over 10000 records).

The message means that you try to retrieve a big field of data in a less big variable.
0
 
LVL 1

Expert Comment

by:Deckmeister
ID: 2639028
To complete my answer:

If the complete error message is "ODBC — field would be too long; data truncated." (Error 3231), then you tried to perform a task on an ODBC data source that would have resulted in a field that is too long. The data has been truncated to the maximum allowable length.

0
 
LVL 1

Expert Comment

by:Deckmeister
ID: 2639035
Another possible origin of the error: when using MFC ODBC to call a Microsoft SQL Server stored procedure that returns a CHAR or VARCHAR output parameter, the buffer intended to hold the data returned will be Null and ODBC will return the error:

   Warning: ODBC Success With Info, Data truncated
   State:01004,Native:0,Origin:[Microsoft][ODBC SQL Server Driver]

If this is the error, simply go to http://support.microsoft.com/support/kb/articles/Q182/3/86.ASP to have the solution.
0
Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

 

Author Comment

by:twg
ID: 2640992
I read a little about "data truncated" in the MSDN
help of microsoft. It's written there that "if the byte length of the data is greater than the byte length of the buffer, the driver truncates data being fetched to the byte length of the buffer and returns SQL_SUCCESS_WITH_INFO with SQLSTATE 01004(Data truncated)".

My question is : is it possible to make the buffer bigger enough for my data so I won't get this message?
0
 

Expert Comment

by:Subramanya
ID: 2641722
SQL_SUCCESS_WITH_INFO  it also returns
some Structure info there You can get the buffer size required.Now you can
reinitialise buffer to required size
0
 

Author Comment

by:twg
ID: 2643307
Thanks subramanya.
How do I reinitialize the buffer's size?
0
 
LVL 1

Expert Comment

by:Deckmeister
ID: 2648001
Hi again,

Simply take a look at http://msdn.microsoft.com/library/psdk/dasdk/odch8pm6.htm, where your problem is listed.

See the section getting long data where it is explained to use SQLGetData instead of SQLFetch in order to retrieve long data.
With respect to a single column, SQLGetData behaves in the same manner as SQLFetch: It retrieves the data for the column, converts it to the type of the application variable, and returns it in that variable. It also returns the byte length of the data in the length/indicator buffer.
There is more explanation and an example of that at http://msdn.microsoft.com/library/psdk/dasdk/odch6jmp.htm

Regards
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question