Solved

data truncated

Posted on 2000-03-20
7
752 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
  • 4
  • 2
7 Comments
 
LVL 1

Accepted Solution

by:
Deckmeister earned 30 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now