join mutliple table dynamically

join mutliple table dynamically

Post by FR » Wed, 26 Sep 2001 05:41:22



I have multiple tables listed in a certain table say 'TABLELIST'

I want to do a cross join of all the tables in the ' TABLELIST' on a certain
join condition. There is a col say 'colmain' that has the same name in all
tables..

How can i do this ?

Tablelist

Name

TableA
TableB
TableC
TableD
...

So i want to join all these tables based on colmain

Thanks

 
 
 

join mutliple table dynamically

Post by Ilya Margoli » Wed, 26 Sep 2001 06:05:04


Cross join does not take join conditions, but if you ment any other join
types then yes, it is possible. Put your select, from, and the rest of
clauses into three or more varchar variables. Construct from clause using
cursor.

Execute as follows:



Quote:> I have multiple tables listed in a certain table say 'TABLELIST'

> I want to do a cross join of all the tables in the ' TABLELIST' on a
certain
> join condition. There is a col say 'colmain' that has the same name in all
> tables..

> How can i do this ?

> Tablelist

> Name

> TableA
> TableB
> TableC
> TableD
> ...

> So i want to join all these tables based on colmain

> Thanks


 
 
 

join mutliple table dynamically

Post by FR » Wed, 26 Sep 2001 06:25:03


I want to join tables on a certain join.. But i want to return all rows of
the tables ..

Say tableA and tableB

I want to retrieve all rows of A and B and have nulls where it does not find
a matched record .
So dont I need to join ?

Thanks


> Cross join does not take join conditions, but if you ment any other join
> types then yes, it is possible. Put your select, from, and the rest of
> clauses into three or more varchar variables. Construct from clause using
> cursor.

> Execute as follows:




> > I have multiple tables listed in a certain table say 'TABLELIST'

> > I want to do a cross join of all the tables in the ' TABLELIST' on a
> certain
> > join condition. There is a col say 'colmain' that has the same name in
all
> > tables..

> > How can i do this ?

> > Tablelist

> > Name

> > TableA
> > TableB
> > TableC
> > TableD
> > ...

> > So i want to join all these tables based on colmain

> > Thanks

 
 
 

join mutliple table dynamically

Post by FR » Wed, 26 Sep 2001 07:50:56


I found out that I need a Full outer join.. so can you help me with the code
?


> I want to join tables on a certain join.. But i want to return all rows of
> the tables ..

> Say tableA and tableB

> I want to retrieve all rows of A and B and have nulls where it does not
find
> a matched record .
> So dont I need to join ?

> Thanks



> > Cross join does not take join conditions, but if you ment any other join
> > types then yes, it is possible. Put your select, from, and the rest of
> > clauses into three or more varchar variables. Construct from clause
using
> > cursor.

> > Execute as follows:




> > > I have multiple tables listed in a certain table say 'TABLELIST'

> > > I want to do a cross join of all the tables in the ' TABLELIST' on a
> > certain
> > > join condition. There is a col say 'colmain' that has the same name in
> all
> > > tables..

> > > How can i do this ?

> > > Tablelist

> > > Name

> > > TableA
> > > TableB
> > > TableC
> > > TableD
> > > ...

> > > So i want to join all these tables based on colmain

> > > Thanks

 
 
 

join mutliple table dynamically

Post by Steve Kas » Wed, 26 Sep 2001 09:25:05


FR,

  Please don't post questions again as a new thread.  See my answer
to this under yoiur later post, "Full Outer Join dynamically"

Steve Kass
Drew University


> I found out that I need a Full outer join.. so can you help me with the code
> ?



> > I want to join tables on a certain join.. But i want to return all rows of
> > the tables ..

> > Say tableA and tableB

> > I want to retrieve all rows of A and B and have nulls where it does not
> find
> > a matched record .
> > So dont I need to join ?

> > Thanks



> > > Cross join does not take join conditions, but if you ment any other join
> > > types then yes, it is possible. Put your select, from, and the rest of
> > > clauses into three or more varchar variables. Construct from clause
> using
> > > cursor.

> > > Execute as follows:




> > > > I have multiple tables listed in a certain table say 'TABLELIST'

> > > > I want to do a cross join of all the tables in the ' TABLELIST' on a
> > > certain
> > > > join condition. There is a col say 'colmain' that has the same name in
> > all
> > > > tables..

> > > > How can i do this ?

> > > > Tablelist

> > > > Name

> > > > TableA
> > > > TableB
> > > > TableC
> > > > TableD
> > > > ...

> > > > So i want to join all these tables based on colmain

> > > > Thanks

 
 
 

1. DTS Packaging over mutliple tables

I'm supposed to create a DTS package to transfer data from one database to
another. The data needs to be transformed during this transfer. The unique
key for most of the tables in the destination database needs to be obtained
by running a stored procedure on that database. After that i can add the new
records to the database. Then a second problem arrives. The data in the
destination tables needs to be obtained from different source tables. How do
i know what record I'm inserting or updating?
Each set of records in the source database needs to be checked for
completeness by a stored procedure. If a set is complete it can be inserted
in the destination tables. It can be possible that two records from two
different tables in the source database results in three records in one
table of the destination database. How do i get the right data into the
right records?

Kind regards,

Ivo Vink

2. Are you my heart's desire? 14215

3. Inserting data into mutliple tables using SQL Insert Command

4. ***** FRE INTERNET ****

5. Positing mutliple table

6. Best SQLXML 2000 book

7. Showing mutliple columns from different tables in a grid

8. Too many members?

9. Full Outer Join dynamically

10. Dynamically Updating Table Lookup CTRL-SPACE tables

11. Joining tables from a table variable with SQL tables

12. outer joins in query with inner joins on the same table