Left Outer Join

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Diya
Participant
Posts: 38
Joined: Fri Feb 17, 2006 7:02 am

Left Outer Join

Post by Diya »

Hey,

Im using a Dynamic RDBMS stage to fetch data from MS SQL Server.
I want to do a left outer join in the DRS stage.
It is possible using "User Defined SQL" .

But I want to know if it is possible to do it using "Generated SQL Query"

Can anyone help me on this?

Thanks,
Diya
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

It is possible.

Select multiple tables into the "SQL FROM clause" (You could give an alias if you want)

In the Selection tab, where clause write your required condition like

Code: Select all

coulmn1=column2(+)
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's old style Oracle syntax - you sure that works in Sql Server? :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Diya
Participant
Posts: 38
Joined: Fri Feb 17, 2006 7:02 am

Post by Diya »

I tried it and it doesn't work in SQL server.

Any other ideas?
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

Oops, that was oracle's old syntax
Let me give you an old SQL Server Syntax

Code: Select all

 *= 
I dont know if the newer versions of SQL Server support it.
Give it a shot.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It's perfectly feasible. Any of the methods in the stage should support it. I don't use SQL Server - are you not aware of the proper 'left outer join' syntax you'd need? :? Check with your DBA if not.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Diya
Participant
Posts: 38
Joined: Fri Feb 17, 2006 7:02 am

Post by Diya »

Thats working.... :D

Thanks Narasimha
jdmiceli
Premium Member
Premium Member
Posts: 309
Joined: Wed Feb 22, 2006 10:03 am
Location: Urbandale, IA

One thing about the *= format for left join

Post by jdmiceli »

Hi all,

If I remember right the '*=' notation is not supported per se in SQL Server 2000. It still functions only for backwards compatibility purposes, but I believe I read (somewhere) that notation is not supported in SQL Server 2005. Many things that existed for backwards compatibility have been dropped from 2005 as they were considered limiting factors.

If you want the official 'left join' syntax it would be as follows:

SELECT <whatever>
FROM <table1> a LEFT JOIN
<table2> b on a.column = b.column
and a.col = b.col ....
WHERE ...

Hope that offers some additional assistance.

Bestest!
Bestest!

John Miceli
System Specialist, MCP, MCDBA
Berkley Technology Services


"Good Morning. This is God. I will be handling all your problems today. I will not need your help. So have a great day!"
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try to use generated SQL wherever possible. Everything in the table name field becomes the FROM clause. So what you put in the table name field is all of:

Code: Select all

table1 LEFT OUTER JOIN table2 ON table1.key = table2.key
(Adjust as required. Make sure any ambiguous column names are fully qualified in the Derivation field of the Columns grid.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply