title: How to declare an array in SQL server query and how to assign value into this array from other select query
body: <pre><code>ALTER PROCEDURE [dbo].[createTimeFrameReport]
  
  AS
  --BEGIN TRAN
   -- SET NOCOUNT ON added to prevent extra result sets from
   -- interfering with SELECT statements.
  SET NOCOUNT ON;
  --declare @currentYear varchar (4)
  --declare @currentMonth varchar(3)
  --declare @currentDay varchar(3)
  DECLARE @applicationNo varchar(20);
  
  TYPE ListofIDs IS VARRAY(100) OF NUMBER;
  
  
  //how to assign value for below code a.APPLICATION_ID into an array
  SELECT @ListofIDs =a.APPLICATION_ID from BPM_PROCESS_INSTANCE a,BPM_TASK_INSTANCE b,BPM_PROCESS c where b.PROCESS_INSTANCE_ID=a.ID and c.ID=a.TYPE_ID  and a.TYPE_ID=42 
  AND b.ASSIGNED_ROLE IN('IDB_Reviewer','IFP_TechReviewerPermitting','IFP_ProcessManager','IFP_TechReviewerAssessment')
  
  select @ListofIDs
  </code></pre>