>>mcproj="'000609','000172','001113'"
>>
>>? mcproj
>>? SQLEXEC(1,"SELECT *;
>> FROM ZAKI.PROJ Proj;
>> WHERE {fn LEFT(Proj.PROJ_ID,6)} IN (?mcproj) AND {fn LENGTH(Proj.PROJ_ID)}=10;
>> ORDER BY Proj.PROJ_ID")
>>
>
>This is a know problem [at least by me] that you can not parameterize an IN() clause. If your mcProg parameter just has 1 values in it, it will work. The problem is in having to have quotes around each value. There is no way to just pass
'000609','000172','001113' without addition surrounding double-quotes. Now if you do not predefine the value of mcProj, and let VFP prompt you for the list, it will work with more than 1 value.
>
>The only way to get it to work with variables, is to build the list of values:
>cSQL = "......." ;
> + "where .... IN ('" + mcProg1 + "', '" + mcProg2 + "') ..."
>
>I believe,
IN (&mcProg.) will also work.
Is the macro evaluated in VFP before the string is sent to SQlServer?
This is where a class the builds the select string with all parameters evaluated before sending to the back end comes in handy.
BOb