JefB
Programmer
- Dec 29, 2000
- 56
Is it possible to feed a column name to a query as an argument in a procedure?
My goal is a procedure to pull the value(s) from a single field, on the fly using the following code:
CREATE PROCEDURE [dbo].[Eval_Test_Proc]
@FldName text
AS
Select @FldName from
(SELECT Evaluee, Initiative, PosAttitudeCaller, PosAttitudeCoWork, GiveFeedback, Extreme
FROM dbo.TeamEval_Data) x
GO
However, when I execute the procedure:
EXEC dbo.Eval_Test_Proc 'Initiative'
All I get is the word "Initiative"
Any suggestions?
JefB
My goal is a procedure to pull the value(s) from a single field, on the fly using the following code:
CREATE PROCEDURE [dbo].[Eval_Test_Proc]
@FldName text
AS
Select @FldName from
(SELECT Evaluee, Initiative, PosAttitudeCaller, PosAttitudeCoWork, GiveFeedback, Extreme
FROM dbo.TeamEval_Data) x
GO
However, when I execute the procedure:
EXEC dbo.Eval_Test_Proc 'Initiative'
All I get is the word "Initiative"
Any suggestions?
JefB