cString = "1000*1001*1002*" Create Table tempIDs (myId c(4)) ALines(aString,m.cString,.t.,'*') Dimension aString[Alen(aString),1] Insert into tempIds from array aString use Text to m.lcSQL textmerge noshow Select * from myTable as remoteTable inner join OpenRowSet('VFPOLEDB','<<Sys(5)+Curdir()>>';'';'', 'select myId from tempIds') as localTable On remoteTable.personId = localTable.myId endtext lnHandle=SQLStringConnect('DRIVER=SQL Server;SERVER=server;Trusted_connection=Yes') SQLExec(lnHandle, "use myDatabase") SQLExec(lnHandle, m.lcSQL,'myCursor') SQLDisconnect(lnHandle) Erase ('tempIDs.dbf') Select myCursor browseCetin