Solved

data truncated

Posted on 2000-03-20
7
764 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 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
Industry Leaders: 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!

 

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

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 112
Separate into files by filename 12 91
Named range not carried over 10 66
Dell Alienware Graphics Amplifier Driver for non-Alienware systems 18 469
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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

749 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