SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Views


Views

Author
Message
bitbucket-25253
bitbucket-25253
SSC-Dedicated
SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)

Group: General Forum Members
Points: 35015 Visits: 25280
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
Abrar Ahmad_
Abrar Ahmad_
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1986 Visits: 1337
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.


Hugo Kornelis
Hugo Kornelis
SSC-Dedicated
SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)

Group: General Forum Members
Points: 34546 Visits: 13121
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/Data Platform MVP (2006-2016)
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Abrar Ahmad_
Abrar Ahmad_
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1986 Visits: 1337
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.



Paul White
Paul White
SSC Guru
SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)SSC Guru (80K reputation)

Group: General Forum Members
Points: 80248 Visits: 11400
Good question today. No scope for criticism :-)



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
Toby White
Toby White
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3219 Visits: 639
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.
webrunner
webrunner
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16882 Visits: 4141
Good question. I agree, no scope for criticism. Also, I have made such a view, so I know it can be done. :-)

- webrunner

-------------------
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
Ken Wymore
Ken Wymore
SSCrazy Eights
SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)

Group: General Forum Members
Points: 9644 Visits: 2470
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
Hugo Kornelis
Hugo Kornelis
SSC-Dedicated
SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)SSC-Dedicated (34K reputation)

Group: General Forum Members
Points: 34546 Visits: 13121
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/Data Platform MVP (2006-2016)
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Michael Richter-564003
Michael Richter-564003
SSC Veteran
SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)SSC Veteran (203 reputation)

Group: General Forum Members
Points: 203 Visits: 76
Good QOD:-)
TNX
Michael
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search