Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

Creating a View from a CTE

I have a working Common Table Expression and would like to make it into a View.

How do I do that?

Thanks
Avatar of Megan Brooks
Megan Brooks
Flag of United States of America image

The body of a CTE is a query. Take that query and use it to define the view.
Avatar of curiouswebster

ASKER

Yes, that is the question. Can you give me a little example?
SOLUTION
Avatar of Megan Brooks
Megan Brooks
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have a compile error as I am not sure about parens.

Can you please complete your design with an ultra simple query?

Thanks.
Shoot me a sample CTE and I will rearrange it into a CREATE VIEW.
Here's the query I took FROM a CTE....

    SELECT JobType, Timestamp, CallingFunction, My_ID, Status, Error
    FROM MyTable
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Is that considered a CTE inside? Or would a CTE use the WITH statement inside the CREATE VIEW?

If so, please provide that too, since that was my question ;)
I don't understand what you are asking for. You asked to make a CTE into a view. What are you actually trying to accomplish, in greater detail?
I was expecting to see both the VIEW and the CTE in one statement. Is that possible?

Thanks for the help thus far. I will close it and assign you the points after your next answer .
I have a working Common Table Expression

first show what it is...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Scott Pletcher
Scott Pletcher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks