SQL Server 2000 using prompts

CREATE VIEW xxxx AS
SELECT order_date, 
       DATEPART(W, order_date) AS dayID, 
       Type 
  FROM dbo.Shipment_Dates 
 WHERE (TIP = 'normal') 
OPTION (FAST 20)

This element creates the cause of the error in the prompt part. Is there a workaround to add tooltips to views?

+3
source share
2 answers

You cannot use query hints (OPTIONs) in a view.

A view is just a macro that expands. Then the query hint will be internal in the extension because the view is a subquery. Query hints are not allowed in subqueries.

Effectively, you will have the following:

select
   *
from
   (
   SELECT
     order_date, DATEPART(W, order_date) AS dayID, Type 
   FROM dbo.Shipment_Dates 
   WHERE (TIP = 'normal') 

   option (fast 20)  --not allowed
   ) WasAView

From MSDN :

Query hints can only be specified in a top-level query, not in subqueries.

+4
source

:

select order_date, dayID, Type
    from xxxx
    option (fast 20)
+3

Source: https://habr.com/ru/post/1769169/