SQL Server Performance Forum – Threads Archive
Dynamically create a stored procedureI’ve written a stored procedure to produce the code to create a stored procedure (based on parameters). It stores the code in a VARCHAR(8000) and outputs it. This code can be run in Query Analyzer quite happily and works fine. I can’t get it to be called from within the Stored Procedure though. I get the follwing error using EXEC. Server: Msg 203, Level 16, State 2, Procedure CopyGenerator, Line 50
The name ‘code generated’ is not a valid identifier.
Make sure you are doing EXEC (@mystring) and not EXEC @mystring. /Argyle
That was exactly the problem thanks.