SQL Server Performance

counting

Discussion in 'Getting Started' started by jay123, Sep 30, 2008.

  1. jay123 New Member

    howdy,,, all i need to do is count the rows of table a that will never get larger then 40 rows, and out put it to a textbox. this has to be done by a remote connection.. i can count the rows in a data grid, but there isnt enought space for all the rows, only 5 to be exact. so I need to look at the sql server table and count it.
  2. Adriaan New Member

    The basic syntax for getting not more than 5 rows uses the TOP keyword:
    SELECT TOP 5 columnX, columnY, ...
    FROM tableA
    ORDER BY columnZ
    The ORDER BY bit means you get the "top" or "bottom" rows. You can add DESC after any column in the ORDER BY list to get the reverse order (for that column).

Share This Page