>>>>How can I execute a SQL statement stored as a character string. In the example below lcSelect contains the SQL statement. How can I execute this statement using lcSelect?
>>>>
>>>>lcfile = "apdist"
>>>>lcCompany = "99"
>>>>
>>>>lcselect = "Select * from " + "d:\demo\pro73b\sampledata\" + ALLTRIM(lcfile) + ALLTRIM(lcCompany)
>>>
>>>BTW, use TEXT...ENDTEXT to create the string. It lets you create very large strings while keeping the entry of the select like you'd write it to run.
>>>
>>>
TEXT TO lcSelect TEXTMERGE NOSHOW
>>>SELECT * ;
>>> FROM d:\demo\pro73b\sampledata\<<alltrim(m.lcFile)>>
>>>ENDTEXT
>>
>>Mike,
>>He needs to preprocess this to remove semicolons and make it appear as a single line command. ie:
>>
>>
>>lcSelect = Chrtran(m.lcSelect,Chr(9)+';'+Chr(13)+Chr(10),Space(1))
>>
>
>I think you meant POSTprocess. I do that all the time.
>
>>
>>I'd instead do:
>>
>>Select * from ("d:\demo\pro73b\sampledata\" + ALLTRIM(m.lcfile-m.lcCompany))
>>
Cetin
>
>Sure, that works too.
You caught me:) I thought of it as PREmacro.
Cetin