Hello,
I have used stored procedure with parameters.Now I want to use the parameter in the select statement.Following is my code in the procedure.
////////////////////////////////////
CREATE PROCEDURE locationproduct
@tlocation varchar(10),
@tproduct varchar(10)
@TableName varchar(10)
AS
declare @firstquarter int;
SET @firstquarter =
( SELECT SUM(DemandCol) AS firstquarter FROM DemandTable
WHERE location = @tlocation AND product= @tproduct )
insert into abc values (@tlocation,@first);
In the above instead of DemandTable I want to use TableName .
How do I do That?
Thanks,
Prithaa