Solved

data truncated

Posted on 2000-03-20
7
754 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
notReplace  challenge 53 116
Prevent this page from creating additional dialogs. 3 416
dog bark java program 15 88
Can not remove SSL certificate on iPhone 6 - iOS10.2 12 286
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

23 Experts available now in Live!

Get 1:1 Help Now