I am totally confused with this procedure.please correct my mistakes in quotes.
create procedure queryingsfor
@Tabname nvarchar(250),
@colname nvarchar(250),
@opname nvarchar(290),
@valuesname nvarchar(239)
as
begin
set NOCOUNT on;
declare @sql varchar(4000)
set @sql='select * from' +@Tabname+ 'where' +@colname+''''+@opname+''''+ ''''+@valuesname+''''
exec(@sql)
end
exec queryingsfor 'education','eduCurrentStudy','=','DME'
I’m only getting:
Error: Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ‘fromeducationwhereeduCurrentStudy’.
You might want to add some spaces in there
The correct statement would be something like
Or
even better