SQL Error  
Author Message
dwillman





PostPosted: Tue Jan 15 08:58:38 CST 2008 Top

Exchange Servers >> SQL Error

I'm using the following code to locate records from one table which do not
appear in a second.

&cKey = "tag"

ThisForm.cAlias = "customers"

cWorkFile = "c:\temp.dbf"

cJoinField = "account_number"

SELECT &cKey AS key_field FROM (ThisForm.cAlias) WHERE (cJoinField) NOT IN
(SELECT DISTINCT key_field FROM "MY_TAG_TABLE") INTO TABLE (cWorkFile)

I get the error message:

SQL: Queries of this type are not supported

If I replace the trsnsposed variable cJoinField with the actual name of the
field the the code works.

SELECT &cKey AS key_field FROM (ThisForm.cAlias) WHERE account_number NOT IN
(SELECT DISTINCT key_field FROM "MY_TAG_TABLE") INTO TABLE (cWorkFile)

This is generic code which I wish to use against different tables /
parameters etc.

Is there anyway to use a variable instead of the actual field name?

Exchange Server42  
 
 
Anders





PostPosted: Tue Jan 15 08:58:38 CST 2008 Top

Exchange Servers >> SQL Error WHERE &cJoinfield

-Anders



> I'm using the following code to locate records from one table which do not
> appear in a second.
>
> &cKey = "tag"
>
> ThisForm.cAlias = "customers"
>
> cWorkFile = "c:\temp.dbf"
>
> cJoinField = "account_number"
>
> SELECT &cKey AS key_field FROM (ThisForm.cAlias) WHERE (cJoinField) NOT IN
> (SELECT DISTINCT key_field FROM "MY_TAG_TABLE") INTO TABLE (cWorkFile)
>
> I get the error message:
>
> SQL: Queries of this type are not supported
>
> If I replace the trsnsposed variable cJoinField with the actual name of
> the field the the code works.
>
> SELECT &cKey AS key_field FROM (ThisForm.cAlias) WHERE account_number NOT
> IN (SELECT DISTINCT key_field FROM "MY_TAG_TABLE") INTO TABLE (cWorkFile)
>
> This is generic code which I wish to use against different tables /
> parameters etc.
>
> Is there anyway to use a variable instead of the actual field name?
>
>


 
 
Andy





PostPosted: Tue Jan 15 09:12:33 CST 2008 Top

Exchange Servers >> SQL Error Never thought of that!!!!!!

Thanks Anders



> WHERE &cJoinfield
>
> -Anders
>


>> I'm using the following code to locate records from one table which do
>> not appear in a second.
>>
>> &cKey = "tag"
>>
>> ThisForm.cAlias = "customers"
>>
>> cWorkFile = "c:\temp.dbf"
>>
>> cJoinField = "account_number"
>>
>> SELECT &cKey AS key_field FROM (ThisForm.cAlias) WHERE (cJoinField) NOT
>> IN (SELECT DISTINCT key_field FROM "MY_TAG_TABLE") INTO TABLE (cWorkFile)
>>
>> I get the error message:
>>
>> SQL: Queries of this type are not supported
>>
>> If I replace the trsnsposed variable cJoinField with the actual name of
>> the field the the code works.
>>
>> SELECT &cKey AS key_field FROM (ThisForm.cAlias) WHERE account_number NOT
>> IN (SELECT DISTINCT key_field FROM "MY_TAG_TABLE") INTO TABLE (cWorkFile)
>>
>> This is generic code which I wish to use against different tables /
>> parameters etc.
>>
>> Is there anyway to use a variable instead of the actual field name?
>>
>>
>
>