Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Creating a View

Author  Topic 

rohaandba
Starting Member

33 Posts

Posted - 2011-02-15 : 11:52:49
When I need to create a ‘View’ from the columns of different tables in a Database,

Is it necessary that the tables involving in that view should be related directly or indirectly?

That is, should any 2 tables have a common column or an indirect Relationship?

Or is it still possible to create a view with independent tables without any kind of relationship between them (tables)?

Please clarify

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-02-15 : 13:22:57
google "transact SQL Views" if you're looking for what views are ... however if you are looking for some specific scenario, come up with some more details e.g. examples and your requirements in light of that example

Cheers
MIK
Go to Top of Page

rohaandba
Starting Member

33 Posts

Posted - 2011-02-16 : 10:08:12
Actually I will explain in detail.
I have a data base ‘x’.This database ‘x’ has 20 tables.

Among these 20 tables there is one ‘Root Table’ with a Primary key and there are 5 other tables with foreign keys referring to this ‘Root Table’ primary key.

There are 6 other tables which are independent. i.e. these 6 tables are not related to this ‘Root Table’ and the other 5 tables which are in reference with this ‘Root Table’.
These 6 tables neither have foreign keys referring to the ‘Root Table’ nor any common columns with Root Table and its 5 link tables.

Now I am suppose to create a View which involves the columns from the ‘Root Table’, its 5 link tables and the 6 independent tables.

Can any one suggest me how to approach this? Thank you
Go to Top of Page
   

- Advertisement -