Hi,
I have a sp and I need to get top 10 record from sp.
Here is my effort,
DECLARE @Temp TABLE(id INT,Name VARCHAR(20),Phone VARCHAR(20))
INSERT INTO @Temp
EXEC sp_MyListReport
@id, @Name , @Phone
SELECT TOP(10) * FROM @Temp
@id, @Name , @Phone are parameters for sp, but it is not showing any records.
Any help will be appreciated. Thanks in advance

Saravanan VPosted Jun 20, 2017, 9:44 AM
First, directly run the SP separately with required parameter values. This will confirm you that SP returns relevant records or not for the supplied parameters.
eg. EXEC sp_MyListReport 'xx','xxxx','xxxxxx'
Then, before retrieving the top 10 records from temp table, run a select query to check the inserted records.
This way you can easily find out the problem area and change your scripts accordingly.
Let me know if you need any further assistance.
Rajkiran SwainPosted Jun 20, 2017, 9:44 AM