![]() |
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. |
All times are GMT +1. The time now is 01:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com