I have Stored procedure spSelectStudents
is being used like a view and I have no rights to alter it.
I need something like "exec top 10 spSelectStudents"
I have Stored procedure spSelectStudents
is being used like a view and I have no rights to alter it.
I need something like "exec top 10 spSelectStudents"
If you know what results you're getting from the stored procedure, you can always create a (temporary) table (with columns corresponding to the results of executing the stored procedure) and
INSERT #tmptable EXEC spSelectStudents
then query the temporary table in whatever way you want to. An alternative is using OPENROWSET, but that has its own issues and permission requirements.
Below script will move the result of the procedure spSelectStudents
to a temporary table ##tmpTable
CREATE TABLE ##tmpTable (
<Your Colums> < datatype >
)
-- Insert result from the SP to temp table
INSERT INTO ##tmpTable
EXEC spSelectStudents
SELECT TOP 10 * FROM ##tmpTable