GilaMonster (3/1/2013)
opc.three (3/1/2013)
My comment was that the yield from the FROM, WHERE, GROUP BY and HAVING clauses is not altered based on which index the engine picks.I can probably produce you an example where it is (row number over a non-unique column and filter on that row number comes to mind)
I am not picturing it. Wouldn't that require a derived table, in which case the ORDER BY in the ranking function would guarantee the correct result?
Was thinking something like this:
SELECT name,
row_num
FROM ( SELECT ROW_NUMBER() OVER ( ORDER BY name ),
name
FROM sys.tables
) tbls ( row_num, name )
WHERE row_num = 1;
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato