LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default SQL string

Just a guess: maybe you have a single quote in your query that has
accidentally got outside of some double quotes; so the string from
that point onward is treated as a comment.

Something like:

SQL = "Select * from myTable where name="' & strName & "' and [... etc]
(with name="' << double quote then single ;
should be .. name='" << single quote then double)

This would be fairly obvious as the comment part would appear as green.

If that doesn't help, I think you need to post your code.

Andrew


Sajit wrote:

I have an SQL string in a Excel VBA code equated to a string variable. The
SQL is to import data from a group of SQL Server tables. The string is fairly
long. While trying to continue to the next line about 8 0r 10 times, VBA
gives me an error saying that I have exceeded the number of permitted
continuations allowed. I therefore broke the string into 2 and assigned it to
2 variables and then concated the 2.

However when I check string1, I notice that it did not contain all of the
right hand side of the equation. (string1 = "select * from ....). string =
string1 & string2. There does not seem to be any syntax error with the
string. That is, with the & and continuation _. I see in the VBA help that
the allowed lengths are as,

A variable-length string can contain up to approximately 2 billion (2^31)
characters.


A fixed-length string can contain 1 to approximately 64K (2^16) characters.

The strings are not that long. Wonder what is the limitation that cut shorts
the length of the string.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change 3 letter text string to a number string Pete Excel Discussion (Misc queries) 3 December 31st 07 07:47 PM
Replace Hyperlink Addresses Help 'Dim OldStr As String, NewStr As String Ron[_14_] Excel Programming 6 January 23rd 07 07:38 PM
Importing Long String - String Manipulation (INVRPT) (EDI EANCOM 96a) Brian Excel Programming 3 February 9th 06 03:38 PM
to search for a string and affect data if it finds the string? Shwaman Excel Worksheet Functions 1 January 11th 06 12:56 AM
Create a formula into a String then assign string to a cell Myrna Larson[_2_] Excel Programming 6 August 23rd 03 09:42 PM


All times are GMT +1. The time now is 08:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"