I have a question about Microsoft SQL Server 2005. How can I delete or select a row from a table that has a specific row number?
views:
182answers:
2
                +5 
                A: 
                
                
              
            Edit: Modified the code so that it matches more closely to OP's intentions
Declare @RowNum as INT
SET @RowNum = 15 ---Just for example
WITH OrdersRN AS
(
    SELECT ROW_NUMBER() OVER(ORDER BY OrderDate, OrderID) AS RowNum
          ,OrderID
          ,OrderDate
          ,CustomerID
          ,EmployeeID
      FROM dbo.Orders
)
SELECT * 
  FROM OrdersRN
 WHERE RowNum = @RowNum
 ORDER BY OrderDate
         ,OrderID;
                  TheTXI
                   2009-03-18 10:52:34
                
              
                
                A: 
                
                
              
            Check this URL out. Since SQL Server 2005, there is a function called "row_number()" that is what you are looking for.
                  Pablo Santa Cruz
                   2009-03-18 10:53:31