Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 123»»»

Views Expand / Collapse
Author
Message
Posted Tuesday, April 20, 2010 10:35 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 10:51 AM
Points: 5,617, Visits: 25,213
Comments posted to this topic are about the item Views

If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #907420
Posted Wednesday, April 21, 2010 1:01 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, September 4, 2014 5:16 AM
Points: 211, Visits: 1,115
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.


Post #907481
Posted Wednesday, April 21, 2010 2:16 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 12:03 PM
Points: 6,000, Visits: 8,264
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
Post #907525
Posted Wednesday, April 21, 2010 2:52 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, September 4, 2014 5:16 AM
Points: 211, Visits: 1,115
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.


Post #907555
Posted Wednesday, April 21, 2010 6:18 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 8:59 AM
Points: 11,194, Visits: 11,166
Good question today. No scope for criticism



Paul White
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #907661
Posted Wednesday, April 21, 2010 6:49 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, November 9, 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.
Post #907685
Posted Wednesday, April 21, 2010 7:16 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 11:43 AM
Points: 2,373, Visits: 2,723
Good question. I agree, no scope for criticism. Also, I have made such a view, so I know it can be done.

- webrunner


-------------------
"Operator! Give me the number for 911!" - Homer Simpson

"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
Post #907701
Posted Wednesday, April 21, 2010 7:21 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 12:10 PM
Points: 3,313, Visits: 1,985
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
Post #907709
Posted Wednesday, April 21, 2010 7:37 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 12:03 PM
Points: 6,000, Visits: 8,264
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
Post #907719
Posted Wednesday, April 21, 2010 7:42 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, June 17, 2014 7:03 AM
Points: 194, Visits: 65
Good QOD
TNX
Michael
Post #907724
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse