>lResult = SQLEXEC( SqlHandle, cSqlSelect, cQueryName)
>
>and the cSqlSelect looks like this (simplified):>select Table1.fielda from Table1 left join Table2 on Table1.pk = Table2.pk where table2.field2 = '1234' >>The challenge is that the SqlHandle is for SQL Database Table1 and Table2 has a different handle (e.g. SqlHandle2). That is, Table2 is in a different database.
select Table1.fielda from Table1 left join db2.dbo.Table2 on Table1.pk = Table2.pk where table2.field2 = '1234' -- assumming the schema is dbo and the database is db2 for table 2if is not in the same instance then you will need to create a linked server on the first instance and add the linked server in a four part naming [linked server].[database].[schema].[table]