>I wish to create a local cursor, for reporting, from the data in two separate remote tables, each in their own database.
>
>Database D1, table T1 holds Orders and ItemNo
>Database D2, table T2 holds ItemNo and ItemDetail
>
>Both tables are too large to consider bringing either down to my local machine in their entirity.
>
>I currently do:
>
>LcSearchString = “12345”
>
>Handle1 = SQLConnect(“One”)
>LcSQLCode1 = “select T1.Orders, T1.ItemNo FROM T1 WHERE T1.Orders = ?lcSearchString”
>SQLExec(Handle1, lcSQLCode1, “Cursor1”)
>
>Handle2 = SQLConnect(“Two”)
>LcSQLCode2 = “select T2.ItemNo, T2.ItemDetail FROM T2 INNER JOIN Cursor1 ON T2.ItemNo = Cursor1.ItemNo”
>SQLExec(Handle2, lcSQLCode2, “Cursor2”)
>
>The above fails with a misleading message that is sort of the equivalent of file not found. I believe that the last SQLExec can’t see Cursor1
>
>Any thoughts …
You're right, it can't. THe server can't see cursors on the client. YOu need to combine the two above select statements into one:
SELECT T2.ItemNo, T2.ItemDetail FROM T2 INNER JOIN T1 ON T2.ItemNo = T1.ItemNo AND T1.Orders = ?lcSearchString
Erik Moore
Clientelligence