As below,i'm trying to enter a string name into a (varchar type) variable when executing a stored procedure,but sql server gives me an error on the string name (Invalid column name);
exec updt 'unigroup',' groupcode=6','nameg="hardeware"'
(hardware is the string name here)
The updt procedure is a stored procedure that creates an update query(for any table and any column given in the table) as below:
create procedure updt @tn varchar(1000),@fn varchar(1000),@co varchar(2000) as declare @st varchar(5000) set @st='update '+@tn+' set '+@fn+' where '+@co exec(@st)
The @co variable is the update condition variable,which has to hold the name of a string in some cases but sql gives an error when i enter a string name in quotations in the variable.In other cases the stored procedure works fine.
Any idea what the correct syntax is for this issue?Any help would be appreciated.
Thanks in advance.

New Topic/Question
Reply



MultiQuote




|