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
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 Query Builder-Joining Views with Default Condition

Author  Topic 

cirajc
Starting Member

24 Posts

Posted - 2010-09-26 : 04:02:44
Dears

I am Having one UserInterface with For Querying Data with Predefined Views.It should be Like tHis
a)When i try to JOIN two Views inorder to select different columns
then i to generate ON condition for those VIEWS by default through Asp.Net Server Side .
b)I never practiced by providing KEYS or constraints for Views, Is it possible?.if Possible then How??
Eg: View1 = CUSTOMER_SALESMAN,View2 = CUSTOMER_LIST
Common Column is Address No: of Customer.

Please Reply your Suggestions

Thanks & Regards




ciraj

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-26 : 04:05:56
Here's a quick example:

SELECT ...
FROM Table1 t1
JOIN Table2 t2
ON t1.Customer = t2.Customer
WHERE ...

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

cirajc
Starting Member

24 Posts

Posted - 2010-09-26 : 04:16:42
Thank you very much for your Reply.

One Clarification i need to give is ..
This is From Interface i am Slecting Views via binding through dropdownlist & columns using CheckBoxList.
When we select CheckBoxList for each Views,apply any JOIN Type.
At the same Time i need to generate ON COndition with respect to KEYS for both Tables\Views(WIthout Selecting those COndition seperately throug Interface)



ciraj
Go to Top of Page

cirajc
Starting Member

24 Posts

Posted - 2010-09-26 : 04:24:58
I need Clarification Regarding ..

1) While Selecting User specific Column, whether any possibility to take Key COlumn to assign ON Condition inorder to generate the
JOIN Query Complete.

2)Im Having Different Option for Filtering Data with Columns & Values


ciraj
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-26 : 04:25:59
I don't understand your post. I'm not a programmer.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

cirajc
Starting Member

24 Posts

Posted - 2010-09-26 : 04:36:47
Sorry I Just Saw your Profile.
Because of this ".NET Inside SQL Server (2005)" forum i made a Topic Like that.

I want to ask one thing to you.

Whether we can specify PK or FK for Views,Is it Possible?

Views are Created using those tables which is having PK & FK Defined..
SO is it Required?

ciraj
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-26 : 10:39:15
PKs and FKs are put on tables. You can put a clustered index on a view, but that is not typical.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

cirajc
Starting Member

24 Posts

Posted - 2010-09-28 : 07:12:42
Dear,

Kindly clarify me whether i can use clustered indexing for each Views and using this we may be able to know which view had selected from dropdown and get those value inorder make default WHERE condition.
Awaitiing you reply in this regard.

ciraj
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-28 : 13:17:58
Your question is not clear.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

cirajc
Starting Member

24 Posts

Posted - 2010-10-02 : 02:55:41
Dear,

I am having two dropdownlist binding with two seperate Views, with this im going to JOIN for querying . While Selecting those Views
i need to create an ON Condition based on PK & FK of those Views.
How can i identify those KEYS while selecting columns using VIEWS...




ciraj
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-02 : 15:09:29
You would check the table and view design to determine what to join on.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -