473,806 Members | 2,321 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Text truncated to 255 chars with ODBC

code green
1,726 Recognized Expert Top Contributor
I am using an ODBC connection to a MS Access database.
When using a SELECT statement and collecting the data via php ODBC functions, I find that the data from TEXT fields is truncated to 255 characters.
The texr fields are up to 1400 chars in length and some contain HTML tags,
but the maximum length returned is 255.
Any insight appreciated
Oct 2 '07 #1
8 8846
Motoma
3,237 Recognized Expert Specialist
I am using an ODBC connection to a MS Access database.
When using a SELECT statement and collecting the data via php ODBC functions, I find that the data from TEXT fields is truncated to 255 characters.
The texr fields are up to 1400 chars in length and some contain HTML tags,
but the maximum length returned is 255.
Any insight appreciated
Check the value of odbc.defaultlrl . This may be causing truncation is set low.
Oct 2 '07 #2
code green
1,726 Recognized Expert Top Contributor
Thanks Motoma, already found that suggestion in php manual.
Tried [PHP]ini_set ('odbc.defaultl rl','65536');[/PHP]Had no effect.
Expand|Select|Wrap|Line Numbers
  1. Bill Gates 1 TSDN 0
Oct 2 '07 #3
Motoma
3,237 Recognized Expert Specialist
Thanks Motoma, already found that suggestion in php manual.
Tried [PHP]ini_set ('odbc.defaultl rl','65536');[/PHP]Had no effect.
Expand|Select|Wrap|Line Numbers
  1. Bill Gates 1 TSDN 0
I've been doing some Googling because your problem perplexed me. Take a look at this link, specifically the example output for a TEXT column.
Oct 2 '07 #4
code green
1,726 Recognized Expert Top Contributor
Thanks again Motoma. had a look at the article and the following article seems to confirm our fears.
http://support.microsoft.com/kb/214854
So it seems to be a Jet problem. I am copying the data into a MySql DB
Apparently you are supposed to chunk the data in by CHAR size bundles of 255 bytes.
Don't fancy writing the code for that.
May have a look at other type connections, ADO possibly, but only used this with Visual Basic, never php.
Oct 3 '07 #5
code green
1,726 Recognized Expert Top Contributor
Just noticed the maximum size of an Access TEXT field is 255.
They are MEMO fields that I am reading not TEXT fields.
Hope this hasn't mislead anybody.
The same problem still exists of course.
Oct 3 '07 #6
code green
1,726 Recognized Expert Top Contributor
I cannot believe this. I found these words of widom at http://www.codeguru.com/forum/showth...hreadid=320358
Expand|Select|Wrap|Line Numbers
  1. Apparently, it will automatically truncate MEMO fields if your query has a DISTINCT or a GROUP BY in it. 
  2. (You'd think MSDN would warn you about this). All my test queries had a DISTINCT, and a couple had GROUP BY's
Which led me to this article http://www.jdhodges.com/log/1321/
I will have to filter using PHP instead of SQL. That means a complete re-write of my script.
At this point I can only assume this is the correct solution.
The same truncation problem also occurs using mssql DBs but I don't know if the cause is the same.
Oct 3 '07 #7
Motoma
3,237 Recognized Expert Specialist
I cannot believe this. I found these words of widom at http://www.codeguru.com/forum/showth...hreadid=320358
Expand|Select|Wrap|Line Numbers
  1. Apparently, it will automatically truncate MEMO fields if your query has a DISTINCT or a GROUP BY in it. 
  2. (You'd think MSDN would warn you about this). All my test queries had a DISTINCT, and a couple had GROUP BY's
Which led me to this article http://www.jdhodges.com/log/1321/
I will have to filter using PHP instead of SQL. That means a complete re-write of my script.
At this point I can only assume this is the correct solution.
The same truncation problem also occurs using mssql DBs but I don't know if the cause is the same.
All is starting to become apparent now; truncation occurs (and I knew this before, I just didn't think you had led us down this path) on text fields when using DISTINCT and GROUP BY statements because of the overhead of comparing variable length strings as opposed to fixed length strings.

I had just assumed that when you came into the forums and said "ODBC IS TRUNCATING TEXT FIELDS!" you had tested a simple SELECT query to back your statement up ;)

Be careful now, because this truncation will mean that TEXT (MEMO) fields are only distinct on the first 255 characters!
Oct 3 '07 #8
code green
1,726 Recognized Expert Top Contributor
Sorry Motoma. I wasn't aware of this problem with memo fields.
Thar was careless of me calling them text fields.
Just goes to show that if I had posted my query with the problem you may have spotted the reason earlier.
Oct 3 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
13825
by: Guinness Mann | last post by:
I'm running SQL Server 2K (sp3a) and when I run the following query (in query analyzer): SELECT id, LEN(ForeignWord) as Length, ForeignWord FROM Words WHERE Language ='Thai' and LEN(ForeignWord) > 300 ORDER BY Length desc I receive the following results:
4
18827
by: Arabian143 | last post by:
Hey everyone .. i have a website going .. .. ofcourse you use the Ws-FTP to upload the photos to the page .. and i have to use SQL program to insert the file names and values into the Database ..
1
10701
by: relaxedrob | last post by:
Hi All! I am using the DB2 CLP tool and want to format my text columns in a query to truncate the results of a wide text field - 50 char field but I want to display only the first 10 chars. My base query: SELECT EPT620.FORM_TYPE, EPT620.CREATED_BY, EPT620.STATUS, EPT634.SURNAME \ FROM DB2ADMIN.EPT620 EPT620, DB2ADMIN.EPT634 EPT634 \
0
1779
by: Elena Ghetti | last post by:
I have a large 49,000-record table from Excel I would like to import to Access(2002 but the same happens also with XP 2003), mostly text and memo fields. When I use the import wizard, fields are correctly recognized, but then, when checking the resulting table I found that most large fields (from 400 chars to 6000 chars) were truncated somewhere after approx 390 chars (so larger than the 255 max chars for text fields). This is not...
8
2229
by: gene.ellis | last post by:
Hello. I using a simply SELECT statement to retrieve some data from a SQL SERVER via an ODBC connection. I had to go from VARCHAR to TEXT because the amount of data. Anyway, my SQL statements worked just fine when I was using VARCHAR, but now since I am using TEXT, I am only receiving part of the content back. Do I have to do some sort of special Casting or something if I want to get all the content back? It's over 8,000 characters. Thank...
1
8784
by: Kuldeep | last post by:
When i export data from MySQL(server 5.0) i get followng error. SQLSTATE: 01004 String data, right truncated can sombody explain why this is happenning and possible solution!!! consider it as a bit urgent!!!
1
1408
by: skins96 | last post by:
Hello there, I know very little ASP, so I'm begging for help. The script was written by my predacessor.... I haven't made a single change to the script, but all of the suddent I started getting the following error: Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E57) String or binary data would be truncated. /NewsAdd.asp, line 110
2
1344
by: =?Utf-8?B?VG9tIEdhcnRo?= | last post by:
I know that I get pretty dumb late in the day, so I hope someone can just point out the source my stupidity. Below is partial code from a class. I'm accessing the 2 properties and getting truncated results for both. For discussion's sake I'll just describe 1 of them - 'DefaultFileExtension'. This property's ReadOnly method calls the 'GetDefaultFileExtensions' function which should return the value of a constant, which in this case is...
0
918
by: Rich P | last post by:
you could establish a formula where you count the number of characters being displayed when the column width is 50 and then how many chars are displayed with the width is 60, 70, ... Then if the text in a given cell exceeds the number of chars you counted for a given width - you can perform some action - widen the column programmatically, bring up a messagebox, ... Rich
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10618
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10371
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3850
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.