First off ... the GV needs to be created within the DTS package you are executing thru the use of the DTSrun command.
the /A parameter is what tells the DTSrun util that this is a GV. You can have multiple /A parameters which would represent each GV you are passing to the DTS package.
First for good measure, create an SP for your code. Lets call it usp_SelectIt
Code:
CREATE PROCEDURE usp_SelectIt
@SelectValue Int
AS
SELECT *
FROM table_name
WHERE var1 IS NULL
AND var2 = @SelectValue
GO
SO ... in your package you may want to create an "Execute SQL Task" task. In that task you would set the connection, most likely a SQL connection based on your query, and then enter your SP as so ...
The click on the Parameters button and in the Input Parameters tab, under Parameter Mapping:Input Global Variables choose the drop down for your FOO GV. If it does not exist, you need to create it by hitting the Create Global Variables button and defining it.
Remember, it must match up in name, GVs ARE case-sensitive and the data type must match. In your case you have referenced a FOO as a type 3 which is an Integer having a value of 9999999.
Once it is created, then choose it from the drop down as described above. Also remember that you have to define all the GVs that you are passing to the SP. In this case we are only passing one but if you had more, you would need to add one ? for every value. The ? is a placeholder.
Also remember that the order also makes a difference. What you pass in must match the sequence of values the SP, or other tasks, are expecting.
That should do it. Save it and execute it. I am not sure what your next process is to capture or act upon the value retreive from you SP so I will leave it at that.
Enjoy!
Thanks
J. Kusch