Macro Queryes

Feb 1, 2012 at 2:35 AM

I used sucesfull the folowing tip to do a sql inside a avfp page, using macro substituition, work well, but now I found a big wall that only queryes with no more than 255 chars works, Is there any other way to form the sql on the fly and execute ?

  Query =Query+filtro+fgrupo+" order by " + SqlOrder+" Into Cursor 'dados'"


Feb 1, 2012 at 2:45 AM
Edited Feb 1, 2012 at 3:01 AM

Isn't that a foxpro issue? 


A string literal is limited to 255 in length. A string literal means any string between the quotes, like "This is a string literal".

On the other hand a string variable can hold large amounts of data (16 Mb).  


strMyData = "strMyData string variable can hold tons of data while a string"+;

" literal is limited to 255 in length."+;

"You can have many 255 or less characters sized strings concatenated to make up one big string variable."+;

"Try it out ...."

for another way to do it:

text to myStringVariable noshow

You can have long strings here. Such as a multi paragraph story. Or even a chapter of a book.


Feb 1, 2012 at 3:02 AM

The variable is holding

I did the folowing test

query length<%=Len(Query)%>

and appear 480, this means that the big query is holded at variable

If i do <%=Query%> the big sql query appear on browser correct, the problem is to execute the query using macro.


I guess macro is limited to 255 chars even if the variable is ok, and bigger, I'm looking for other king off macro that can hold something bigger than 255 like this

Any tip


Feb 1, 2012 at 3:23 AM

I guess i made a big mistake

Everthing is working fine with the stardanrd &query. macro with comands as long as 1048 chars, I wenr in trouble due to one lost space in query, and the problem vas on the sql statment on the query.

Resuming &query. works fine, it's my falt