关闭

Hints (Transact-SQL)

430人阅读 评论(0) 收藏 举报

Hints are option or strategies specified for enforcement by the SQL Server query prosessor on SELECT, INSERT, UPDATE, OR DELETE statements. The hints override any execution plan the query optimizer might select for a query.

Caution:
Because the SQL Server query optimizer typically selects the best execution plan for a query, we recommend that <join_hint>, <query_hint>, and <table_hint> be used only as a last resort by experienced developers and database administrators.

 

Query hints specify that the indicated hints should be used throughout the query. Query hints affect all operators in the statement. If UNION is involved in the main query, only the last query involving a UNION operation can have the OPTION clause. Query hints are specified as part of the OPTION clause. If one or more query hints causes the query optimizer not to generate a valid plan, error 8622 is raised.

 

Retrieves rows from the database and enables the selection of one or many rows or columns from one or many tables. The full syntax of the SELECT statement is complex, but the main clauses can be summarized as:

[ WITH <common_table_expression>]

SELECT select_list [ INTO new_table ]

[ FROM table_source ] [ WHERE search_condition ]

[ GROUP BY group_by_expression ]

[ HAVING search_condition ]

[ ORDER BY order_expression [ ASC | DESC ] ]

The UNION, EXCEPT and INTERSECT operators can be used between queries to combine or compare their results into one result set.

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:88100次
    • 积分:1736
    • 等级:
    • 排名:千里之外
    • 原创:84篇
    • 转载:8篇
    • 译文:0篇
    • 评论:7条
    文章分类
    最新评论