SSciarrino
3/23/2007 2:29:00 PM
Hope I can explain this.
I have a simple query to check the period totals for each month for projects
that are closed.
Here is the query:
SELECT a.project_id,a.component_id,a.cost_element_id,project_amt_1
FROM DBSproj.dbo.component_monetary_balance AS a, DBSproj.dbo.project AS b
WHERE a.project_id = b.project_id
AND a.amt_class_type = 'ACTUAL'
AND a.curr_type = 'L'
AND a.fiscal_year = '2007'
AND b.project_status = 'C'
AND project_amt_1 <> 0.00'
In the component_monetary_balance table there are 12 columns project_amt_1
to project_amt_12.
I want to have that column be a parameter (as I am going to place this in a
stored procedure)
I looked at sp_executesql but unsure if this will work.
Is it possible to have a column and not a data value become the parameter
you can DECLARE?