November 3, 2008 at 2:23 pm
SET ROWCOUNT 10
SELECT OrderID, CustomerID, EmployeeID, OrderDate
FROM Northwind.dbo.Orders
WHERE EmployeeID = 5
ORDER BY OrderDate
OrderID CustomerID EmployeeID OrderDate
------- ---------- ---------- -----------------------
10248 VINET 5 1996-07-04 00:00:00.000
10254 CHOPS 5 1996-07-11 00:00:00.000
10269 WHITC 5 1996-07-31 00:00:00.000
10297 BLONP 5 1996-09-04 00:00:00.000
10320 WARTH 5 1996-10-03 00:00:00.000
10333 WARTH 5 1996-10-18 00:00:00.000
10358 LAMAI 5 1996-11-20 00:00:00.000
10359 SEVES 5 1996-11-21 00:00:00.000
10372 QUEEN 5 1996-12-04 00:00:00.000
10378 FOLKO 5 1996-12-10 00:00:00.000
However, SET ROWCOUNT will affect any subsequent queries in a connection.
Can you give examples of this ?
Regards
Kevin
November 3, 2008 at 2:53 pm
At the end of your query keep SET ROWCOUNT 0.
Set rowcount is within the scope.so others will not be affected with this.
I suggest you to use TOP instead of rowcount.rowcount was being used in earlier versions of sql server ,then TOP replaced it.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply