Skip to content Skip to sidebar Skip to footer

Execute Stored Procedure Named As A String

How can I execute a stored procedure named as a string I tried this: EXEC CAST(@GetDD AS StoredProcedure);

Solution 1:

Create a dynamic SQL string, and execute that:

declare @sql varchar(512);
set @sql = 'exec ' + @GetDD;
EXEC (@sql);

Post a Comment for "Execute Stored Procedure Named As A String"