all groups > sql server dts > may 2005 >
You're in the

sql server dts

group:

Build Query From Data Transformation Task: Update from a Join?



Build Query From Data Transformation Task: Update from a Join? David Grant
5/29/2005 2:29:52 PM
sql server dts: Hi to everybody!

On using the Build Query option from the Data Transformation task, I' ve
realized that the update query only allows updating a field with a scalar
value.

However I'm trying to use the Data Transformation Task for these kind of
queries:

UPDATE TableToUpdate
SET C_FIELD_ID = ttj.C_FIELD2_ID
FROM TableToUpdate ttu,
TableToJoin ttj
WHERE ttu.TYPE = ttj.C_ID

Can I do this without using the Execute SQL Task?

Thank you from beforehand.

Greetings,
David Grant

Re: Build Query From Data Transformation Task: Update from a Join? David Grant
5/29/2005 3:58:02 PM
Thank your for your quick response, Allan.

In fact, I am of the same opinion but at the office I've been asked to try
to do the ETL process with as fewer Execute SQL Tasks as possible. Howerver,
as the SQL code begins to differ from basic queries, Data Transformation
Tasks seems uncapable to handle it. Not only would this include the "update
from a join" query, but it also would contain "select from select" queries.

I know there's a better and quicker way but could I use the Data
Transformation Task in that fashion?


Greetings,
David Grant

[quoted text, click to view]
Re: Build Query From Data Transformation Task: Update from a Join? David Grant
5/29/2005 4:28:02 PM
Nice example, Allan. You're totally right.



[quoted text, click to view]
Re: Build Query From Data Transformation Task: Update from a Join? Allan Mitchell
5/29/2005 9:41:58 PM
The Data Transformation Task?

The statement you have just written would seem a perfect candidate for
the ExecuteSQL task.

Why do you want to use another task?

Is there more to it than this?

Allan

[quoted text, click to view]
Re: Build Query From Data Transformation Task: Update from a Join? Allan Mitchell
5/29/2005 11:17:02 PM
The ExecuteSQL task is meant to be doing the query you posted. Sure you
can hack the transform Data task to do it but this would be slow and not
what it was designed for.

It is rather like trying to put a screw into a wall with a hammer when
you have a screwdriver in the other hand. The screw would go into the
wall but at what cost? (adapted from Codd - badly)

If that really is the statement you are trying to execute then you
should be using the ExecuteSQL task. If you want to us another task
then sure you can hook up the Transform data task to pump to a lookup
which executes a proc taking values from the Source which in your case
would be a join between the two tables.

You could also use the DDQ task


Note the two tasks above would operate Row*Row and not be that
efficient.

Allan






[quoted text, click to view]
AddThis Social Bookmark Button