Thank you all guys.
Paulhumphris, the TOP keyword solves the problem and the results are excellent. However, the TOP keyword requires the use of an explicit number, not a variable. And if you try to use dynamic SQL to solve this (by formatting the query in string, then running it using exec() function, the table variable @flights_table won't be
Recognized inside the dynamic SQL string… and if you declare it inside the dynamic
string, Then it is not going to be recognized outside of it.
Anyway, I am thinking of using temporary tables in place of table variables as it works will with SET ROWCOUNT and gives expected results. Even though it degrades the performance where I need it most.
Again: Any thoughts, solutions or help are greatly appreciated..
Have a nice day.