Results 1 to 2 of 2

Thread: Fetch Top N Rows

  1. #1
    Join Date
    Jun 2007
    Posts
    0

    Thumbs up Fetch Top N Rows

    Hi ,

    I have a Stored Procedure ,which Fetches Top 10 Rows .


    But now i want to modify this Stored Procedure like Top N rows (
    N
    will be input parameter for the Stored Procedure)

    So What is the Syntax to write like that .Please let me know the
    Steps with an Example

    Your Reply will be very much appreciated....


    Thanks
    Padmakar

  2. #2
    Join Date
    Jul 2007
    Posts
    2
    Place you full result set into a temp table and then run a simple single recursive SQL statement starting with the first row of the above table and adding one row at a time and terminating this process when N rows have been extracted

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •