Could I do something like this:
select top 100 count(id), field1, field2, field3 from ....
Would this return 100 in the count field?
Thanks
I think T-SQL does not support above sematic. field1, field2, ... will need to be part of group by or aggregate function.
Back to you problem, it seems like you want to know total hit count and want it performs well. The problem is that to get total hit count it requires to get the whole result set which is major part of the cost. By using top 100 really will not save you much. If you can remove the requirement to get total hit count, you can then use containstable with a top_n parameter, it will save you a lot for full-text search part.
thanks,
jingwei
没有评论:
发表评论