I\'ve tried searching through search engines,MSDN,etc. but can\'t anything. Sorry if this has been asked before. Is there any performance difference between using the T-SQL
In more complex queries where you can't know your min or max value that you'll be going to compare to beforehand, then using BETWEEN is almost equivalent to using the >= and <= operators.
But when you know beforehand exactly what your min and max values are, it is cheaper not to use the BETWEEN operator and instead compare the wanted results to 1 number below the min and 1 number above the max.
SELECT n.Number FROM dbo.Numbers AS n
WHERE n.Number BETWEEN 1 AND 100
is almost equivalent to:
SELECT n.Number FROM dbo.Numbers AS n
WHERE n.Number >= 1 AND n.Number <= 100
where each row is compared separately for >, < and for =.
rather do:
SELECT n.Number FROM dbo.Numbers AS n
WHERE n.Number > 0 AND n.Number < 101
where each row is compared only for > and <.