|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 12:39 PM
Points: 5,103,
Visits: 20,220
|
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Saturday, May 18, 2013 5:49 AM
Points: 202,
Visits: 1,043
|
|
Dear Author, if you consider the following ... it would be syntax error
CREATE VIEW A_TEMP AS WITH RESULTSET AS (SELECT * FROM SYS.ALL_OBJECTS WHERE TYPE = 'U')
and if you consider the following
CREATE VIEW A_TEMP AS WITH RESULTSET AS (SELECT * FROM SYS.ALL_OBJECTS WHERE TYPE = 'U') SELECT * FROM RESULTSET
it means good you have done.
I conceived your quest statement as 'The Single Defining Select Statement of View Definition' as shown in code segment 1 above.
And i consider the 2nd code segment "SELECT * FROM RESULTSET" as 2nd select statment with in the view defintion.
So please let try to elaborate your quest further so ppl can get really enjoy these quests.
Thank you for next time elaboration.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 3:21 AM
Points: 5,244,
Visits: 7,062
|
|
Good, clean question, Ron. Nice work!
abrar.ahmad-1058946 (4/21/2010) I conceived your quest statement as 'The Single Defining Select Statement of View Definition' as shown in code segment 1 above. The question explicitly states: "Can a View be created using a CTE as part of its defining SELECT statement.?" The emphasized part makes it very clear that the question was not about creating a view using only a CTE as its definining SELECT statement.
Hugo Kornelis, SQL Server MVP Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Saturday, May 18, 2013 5:49 AM
Points: 202,
Visits: 1,043
|
|
Hugo Kornelis (4/21/2010)
Good, clean question, Ron. Nice work! abrar.ahmad-1058946 (4/21/2010) I conceived your quest statement as 'The Single Defining Select Statement of View Definition' as shown in code segment 1 above.The question explicitly states: "Can a View be created using a CTE as part of its defining SELECT statement.?" The emphasized part makes it very clear that the question was not about creating a view using only a CTE as its definining SELECT statement.
following seems cool to me
Do body of a view can contain CTE/s?
Do we can use CTEs within a view defintion?
But i appreciate your "emphasized part" understanding, and would try to correct myself in future.
Thanks buddy.
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 1:03 AM
Points: 10,990,
Visits: 10,543
|
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Friday, November 09, 2012 2:48 PM
Points: 493,
Visits: 636
|
|
| Many times the questions are ambiguous or semantically misleading. This was not one of those times. Also, I learned something new. Thanks for the good question.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 1:47 PM
Points: 2,118,
Visits: 2,213
|
|
Good question. I agree, no scope for criticism. Also, I have made such a view, so I know it can be done. 
- webrunner
------------------- "The chemistry must be respected." - Walter White
"A SQL query walks into a bar and sees two tables. He walks up to them and says 'Can I join you?'" Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 10:59 AM
Points: 2,579,
Visits: 1,537
|
|
Nice QOD! Does anyone have a link to a view that uses a CTE in its definition? I had never even considered doing this and would like to see an example if anyone has a fairly simple one.
Thanks,
Kenny
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 3:21 AM
Points: 5,244,
Visits: 7,062
|
|
Kenneth Wymore (4/21/2010) Does anyone have a link to a view that uses a CTE in its definition? Go to the page referenced in the explanation of the question; scroll all the way down to the community content; check out the second example.
Hugo Kornelis, SQL Server MVP Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, August 14, 2012 8:19 AM
Points: 184,
Visits: 58
|
|
Good QOD TNX Michael
|
|
|
|