|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, January 18, 2013 5:32 AM
Points: 61,
Visits: 171
|
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: 2 days ago @ 12:43 AM
Points: 584,
Visits: 1,574
|
|
An interesting question, but a very roundabout way of asking "Does SQL Server 2005 support OPTION (...) hints within Views?" 
S.
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Yesterday @ 8:26 AM
Points: 3,164,
Visits: 4,344
|
|
Good question.
____________________________________________ Space, the final frontier? not any more... All limits henceforth are self-imposed. “libera tute vulgaris ex”
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Friday, January 18, 2013 5:32 AM
Points: 61,
Visits: 171
|
|
.. it doesn't .. but you can create a sp instead when you want to use cte. Normal OPTION () hints can only be used within select's as i know
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Thursday, June 13, 2013 8:50 PM
Points: 3,208,
Visits: 4,178
|
|
matt32 (2/10/2010) but you can create a sp instead when you want to use cte ... or you can create a view without OPTION clause and add OPTION to the SELECT statement 
SELECT * FROM month_since_200701 OPTION(MAXRECURSION 0)
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Friday, June 14, 2013 7:34 AM
Points: 2,865,
Visits: 2,472
|
|
I thought it was a good question. It caused me to think and read a couple of times to make sure of what I was reading. It also caused me to remember something that I hadn't though of in a long time thus refreshing my memory.
Steve Jimmo Sr DBA “If we ever forget that we are One Nation Under God, then we will be a Nation gone under." - Ronald Reagan
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Friday, March 15, 2013 2:43 PM
Points: 3,924,
Visits: 1,554
|
|
sjimmo (2/10/2010) "it doesn't .. but you can create a sp instead when you want to use cte"
Matt32 - The question was about a view.
Why do so many complain about a question that is not there? If the question is for a view, why do we not address it from that aspect?
I felt it is a good question. But Matt is not complaining here. He is giving an alternative to use CTE OPTION in proc instead of view.
SQL DBA.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: 2 days ago @ 1:31 PM
Points: 2,558,
Visits: 17,421
|
|
I got it right, but for the wrong reason. Is it my imagination or is the UNION ALL in the wrong spot? Shouldn't it go between the SELECTs?
Chad
|
|
|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Monday, June 10, 2013 7:59 PM
Points: 1,491,
Visits: 3,010
|
|
Chad Crawford (2/10/2010) I got it right, but for the wrong reason. Is it my imagination or is the UNION ALL in the wrong spot? Shouldn't it go between the SELECTs?
ChadIt's in the right place. The UNION ALL is already between the two SELECTs within the CTE. That's what enables the recursive nature of the CTE -- having that anchor point defined (the 2007-01-01)
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Yesterday @ 3:33 PM
Points: 18,858,
Visits: 12,443
|
|
|
|
|