>declare @csrAPItem table (fpokey Char (12) NOT NULL) ; INSERT INTO @csrAPItem (fpokey) VALUES ('706652 11 0') ; > |--Table Insert(OBJECT:(@csrAPItem), SET:(@csrAPItem.[fpokey]=RaiseIfNull('706652 11 0'))) > SELECT a.* from apitem a inner join @csrAPItem b ON a.fPOKey = b.fPOKey > |--Compute Scalar(DEFINE:([a].[fmdescr]=[a].[fmdescr], [a].[fmnotes]=[a].[fmnotes], [a].[fvptdes]=[a].[fvptdes])) > |--Bookmark Lookup(BOOKMARK:([Bmk1000]), OBJECT:([M2MDATA40].[dbo].[apitem] AS [a])) > |--Nested Loops(Inner Join, OUTER REFERENCES:([b].[fpokey])) > |--Table Scan(OBJECT:(@csrAPItem AS [b])) > |--Index Seek(OBJECT:([M2MDATA40].[dbo].[apitem].[pokey] AS [a]), SEEK:([a].[fpokey]=[b].[fpokey]) ORDERED FORWARD) >>
>>>>>* Create SP string with: >>>>>* 1. Table variable. >>>>> >>>>>lcSQL = "declare @csrAPItem table (fpokey Char (12) NOT NULL) " >>>>> >>>>>* 2. Insertion of a value into table variable >>>>>lcSQL = lcSQL + "INSERT INTO @csrAPItem (fpokey) VALUES ('706652 11 0') " >>>>> >>>>>* 3. Join with main table >>>>>lcSQL = lcSQL + "SELECT a.* from apitem a inner join @csrAPItem b ON a.fPOKey = b.fPOKey" >>>>> >>>>>lnResult = SQLEXEC (lnHandle, lcSQL, "csrAPItems") >>>>>>>>>>