>TEXT to lcS NOSHOW >if object_id('tempdb..#csrI_Item') is not null > drop table #csrI_Item >select * > into #csrI_Item > from i_items > where 1 = 0 >ENDTEXT > >mysqlexec(m.lcS, '', PROGRAM()) && no cursor is created, so call this function as it should :-) > > >TEXT to lcS NOSHOW >INSERT INTO #csrI_Item >select * > from i_items > where department = ?m.cDep > and category = ?m.cCat > and item = ?m.cItem >SELECT * from #csrI_Item >ENDTEXT > >mysqlexec(m.lcS, 'i_items', PROGRAM()) > >TEXT to lcS NOSHOW > >select * from i_attlnk WHERE invent_id in (select invent_id FROM #csrI_Item) >DROP TABLE #csrI_Item >ENDTEXT >mysqlexec(m.lcS, 'i_attlnk', PROGRAM()) >>Something like that.