Hi
I am creating an store procedure in sql server 2005. i want to pass table name as parameter dynamically in sp. here is my sp but it give me an error
ALTER PROCEDURE dbo.ImportToTable
(
@TableName nvarchar(100),
@que_id int ,
@sub_code int,
@chap_no int,
@que nvarchar(max),
@opt1 nvarchar(max),
@opt2 nvarchar(max),
@opt3 nvarchar(max),
@opt4 nvarchar(max),
@ans nvarchar(max),
@solution nvarchar(max)
)
AS
insert into @tablename (que_id,sub_code,chap_no,que,opt1,opt2,opt3,opt4,ans,solution) values(@que_id,@sub_code,@chap_no,@que,@opt1,@opt2,@opt3,@opt4,@ans,@solution)
RETURN
it give an error must declare the table variable "@TableName"
how i can solve the problem