Hai all,
I created a stored procedure, there i need to store a value returned from a query. My code is given below
[code]
CREATE PROCEDURE mypro (@users varchar(150))
AS
declare @myvar varchar(150)
declare @mycnt int
BEGIN
set @myvar='select count(*) from ' + @users + '_Catalog'
set @mycnt=exec (@myvar)
PRINT @mycnt
END
[/code]
For the above code, the below ERROR Message shown
[code]
Incorrect syntax near the keyword 'exec'.
[/code]
Thanks & Regards
Rajkumar J