Click to See Complete Forum and Search --> : Does is exist a limit with string?
jaimelopez
July 17th, 2001, 09:04 AM
Hi!
I try to execute an SQL that has been builded on a string. When I show the value of the string, it seems like the string had just the first 255 positions of the whole SQL, and of course I become an error from the ODBC driver (in this case is an INSERT instruction). Is it possible to execute SQL longer than 255 characters?
Thanks in advance.
Jaime.
Cakkie
July 17th, 2001, 10:17 AM
This shouldn't be any problem, so I think you need to look for the reason that your string is only 255 long.
How is the string declared, strings can be declare being fixed length, possibly resulting in data loss.
What actions do you do with the string? Sometimes people do actions like Left, mid, right and stuff on a string, in order to get only a part of the data, like for instance (often used when dealing with SQL) to chop off trailing comma's. Check if you don't chop off the wrong part, or that you made a miscalculation for the length.
Finally, check if all variable names are correct, turn on option explicit to be sure, and double check if you are really adding the data to the correct string.
I once saw this guy building a huge WHERE clause for his SQL string, but at the end, in stead of writing strSQL = strSelect & strWhere he wrote strSQL = strSQL & strSQL. These kind of error are very common, and can be a pain in the a**, cause you always look over them.
Tom Cannaerts
slisse@planetinternet.be
Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
michi
July 17th, 2001, 11:09 AM
I met the same problem before. It seems that the maximum of string in VB has the limit of 255. If you can make a deep research on it, I'd like to hear the best solution. What I did before is shrinking the SQL string. :-(
Regards,
Michi
MCSE, MCDBA
Kdev
July 17th, 2001, 12:32 PM
I have to agree with Cakkie on this one.
Quote from MSDN:
The String data type can store fixed-length strings ranging in length from 0 to approximately 63K characters and dynamic strings ranging in length from 0 to approximately 2 billion characters.
I have built a SQL query that was well over 255 characters with no problem. I did sometimes have problems when trying to check what was actually in the string. For example is a message box limited in display length? Maybe your string is being truncated by something else.
But it is possible to store more than 255 characters in the string.
-K
dfwade
July 17th, 2001, 02:41 PM
I have seen this problem, it has to do with
ADO limitation rather than VB string. I was passing in a large IN List that each item was wrapped with ' instead of " , i used the replace function before executing the call and it worked fine.
dfwade
July 17th, 2001, 02:56 PM
I have seen this problem, it has to do with
ADO limitation rather than VB string. I was passing in a large IN List that each item was wrapped with ' instead of " , i used the replace function before executing the call and it worked fine. You might want to try this, I hope it helps
jaimelopez
July 18th, 2001, 02:13 AM
Ok.
I found about the stupid problem.
You are right, I got it to work.
Thaks.
Jaime.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.