DECLARE @ID INT
SET @ID = (select top 1 USER_REQ_JOB_ID 
           from T8504_USER_REQ_JOB 
           where JOB_GRP_ID = 160 
           order by LST_UPDT_TS desc)
SELECT INPUT_PARM_VAL_TX 
from TBL_RPT_JOB_INPUT_PARAM 
where USER_REQ_JOB_ID = @ID
This returns these results:
USA
USCC
6
7
2
These five records what I get I want to assign to five different variables to use in stored procedure.
I was trying with table variable like this :
declare @CID table (
  Region Char(3)
  ,Segment Char(3)
  ,MasterContractId int
  ,ctcid int
  ,templateid int)
insert into @CID (Region,Segment,MasterContractId,ctcid,templateid)
But how to insert that 5 rows here?
 
     
     
     
    