This procedure has three parameters. But when I try to execute by passing parameters it shows me an error. Please help me.
create procedure queryfunctions @Tabname varchar(150),@colname varchar(150),@valuesname varchar(150)
as
begin
declare @sql varchar(4000)
select @sql='select * from @Tabname where @colname=@valuesname'
exec(@sql)
end
exec queryfunctions 'education','eduChildName','Revathi'
Error :
Msg 1087, Level 15, State 2, Line 1 Must declare the table variable "@Tabname".
educationtable where theeduChildNamecolumn contains the string value'Revathi'and not the row(s) where theeduChildNamecolumn contains the same value as theRevathicolumn?