I have a search function set up, where I run multiple queries simultaneously. The top 1000 results of each query are written to a table. (These run async--I am just leaving out
The following SQL limits the number of rows to 4 from any subsequent query
SET ROWCOUNT 4
SET @Rows = @@ROWCOUNT
Get the number of rows form the preceeding select
so something like
SELECT TOP etc...
SET @Rows = @@ROWCOUNT
SET ROWCOUNT 1000 - @Rows
Will probably error if @row goes below zero
but you an trap this with IF and goto PROC_LABLE