i want to contorl the output number of row with a certain number when select data from table that not exceed the number with my setting.
For example,if the result is exceed the 500 rows, then i just require 200 rows, that what is the command of this function?
Thanks for any help...
You can try something like:
SELECT top 500
...
from TableName
another more archaic form is to execute
SET ROWCOUNT 500
However, this will also limit the number of records update or inserted, deleted etc. Turn off the limit by:
SET ROWCOUNT 0
The TOP option is in general the better option. Look the two up in books online.
sql
No comments:
Post a Comment