SSIS: Create variable using value from SQL task query

Basically I am trying to get the sum of a column in my detail rows into the footer of an exported flat file. I created a variable called footer which has the row count. Now I am trying to add the sum of a column to the footer as well. Is there a way to create a variable called Sum and assign it the value of the sum from my SQL Task?

Footer
"3 209001"+right("00000000"+(DT_WSTR,8)@[Count],8)

SQL Task
declare @Sum decimal
select @sum = sum(convert(decimal(12,2),debt_amount)) from my_vw

Nevermind - I just took the variable declaration out of my SQL task and left the select statement. Changed the resultset of the task to single row and set the result set to my variable I created in SSIS. Then modified my footer variable to include the amount.