Monday, September 10, 2007

Question :
When using index (not using hint) in a select statement without 'GroupBy' or
'OrderBy' in what sequence do the records occur

Answer:
When using Index hint, the index chosen is hinted to the SQL server as the
one that should be used for the query.
(you shouldn't use this unless you are very sure that's the best selective
index there ever will be for the table)

the index (without hint) is interpreted into a simple ORDER BY clause, so
the records will be ordered in the order of the fields from the index.

( you can turn on logging SQL statements and see the actual query being sent
to the server)

No comments: