-
Try the following stored procedure:
CREATE PROCEDURE MySP @TABLE VARCHAR(30), @Start INT, @NumOfRecords INT AS
SET NOCOUNT ON
DECLARE @STR VARCHAR(3000)
DECLARE @counter INT
SELECT @counter = @Start
SELECT @STR ='DECLARE curs CURSOR SCROLL FOR SELECT * FROM '+@TABLE
EXEC (@STR)
OPEN curs
WHILE @counter < (@Start + @NumOfRecords) AND @@FETCH_STATUS <> -2
BEGIN
FETCH ABSOLUTE @counter FROM curs
SELECT @counter = @counter + 1
END
CLOSE curs
DEALLOCATE curs
GO
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|