LOCAL lcList as String lcList = '' SCAN lcList = lcList + ',' + TRANSFORM(idField) ENDSCAN SQLEXEC(lnHandle, 'execute StoredProcName ' + SUBSTR(lcList, 2), 'curResult')Then, your stored proc could look something like this:
CREATE PROCEDURE dbo.joinProc ( @idList varchar(2000) = "" ) as set nocount on declare @query varchar(2500) set @query = "SELECT table1.fieldList, table2.fieldList " set @query = @query + "FROM table1 " set @query = @query + "INNER JOIN table2 " set @query = @query + "ON table1.id = table2.id " set @query = @query + "WHERE table2.id IN (" + @idList + ")" execute (@query) returnBe aware that build queries to execute like this is a bit harder to debug, but it works great when you need dynamicly built queries.