Hi Guys.. I just wonder how views work in sql server,I never used it. I have pulled up a result set as per my requirement through a view by doing some inner joins. Though I do not have any relationship between 2 tables but my view pulls up records from those 2 tables by having an inner join. Is it possible tht I can do inner joins though i do not have relationship in my schema. As I am new to SQL, can any one tell me clearly where and how we can make use of views or can give any link where i can read abt them. Thanks! "He laughs best who laughs last"
Goto article sections and read more about VIEW Give table structure, sample data and the code you used Madhivanan Failing to plan is Planning to fail
Ok 1 question.. If am deleting a relationship from my view design mode, does it also deletes in my DB scehma? Thanks! "He laughs best who laughs last"
In a view you don't have relationships, only JOINs like in any regular SELECT query. If a JOIN in a view corresponds to a relationship, then you will see the one-to-many or one-to-one signs showing next to the JOIN in the graphical representation, just for information.(*) It's still only a JOIN, not a relationship. You can drop the JOIN from the view, but make sure that you understand what a JOIN does. (*) Only if you create the view in EM using the diagram pane.
so it means that I can delete any join from the view but still my DB schema will not effect? Thanks! "He laughs best who laughs last"
Yes, Views are virtual table which takes data by joining two or more tables and then if you delete the join it will not affect any table. You can also read about views in Books Online.
http://www.informit.com/articles/article.asp?p=130855 http://odetocode.com/Articles/299.aspx Fyi. Satya SKJ Moderator http://www.SQL-Server-Performance.Com/forum This posting is provided “AS IS†with no rights for the sake of knowledge sharing.