store result of select query into array variable
You cannot store 17 values inside a scalar variable. You can use a table variable instead.
This is how you can declare it:
DECLARE @a TABLE (id uniqueidentifier)
and how you can populate it with values from Enrollment
table:
INSERT INTO @a
SELECT EnrollmentID FROM Enrollment
You should declare @a as a Table Variable with one column of type unique identifier as follows:
DECLARE @a TABLE (uniqueId uniqueidentifier);
INSERT INTO @a
SELECT EnrollmentID
FROM Enrollment;