I use an subquery according below that will use a stored procedure. Input data to the stored procedure arrive from main sql. But it does not work. The code below is an outline to show what I mean. I want to use artid_head and artnr_head from main sql as input to my stored procedure in the subquery. SQL is much larger in practice...Select tblArt.artid_head, tblBen.artnr_head, (SELECT FIRST STRING(ct_disp.customer) + ' / ' + (select customer.k_namn from customer where customer.k_kod =ct_disp.customer) FROM (SELECT period as period, lev_customer as customer, qty + SUM(best - reserv) OVER (PARTITION BY artnr ORDER BY datum ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as qty FROM sp_get_info(artnr_head, artid_head, 1)) AS ct_disp WHERE ct_disp.qty < 0 ORDER BY ct_disp.period) as cc_plan_customer FROM tblArt, tblBen WHERE tblArt.ID = tblBen.ID