dbTalk Databases Forums  

DTS Data Driven Query - Update column only if source not NULL?

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss DTS Data Driven Query - Update column only if source not NULL? in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ralekel@comcast.net
 
Posts: n/a

Default DTS Data Driven Query - Update column only if source not NULL? - 04-12-2006 , 03:24 PM






I'm trying to use a data driven query to update a destination table
with overrides imposed by another table. This override table contains
some records where only certain columns are overriden. Columns I do not
wish to override for a particular record are left NULL.
Is there a simple way I can use a DDQT to write a single update that
will only update the destination column if the source column is not
NULL?

Thanks


Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: DTS Data Driven Query - Update column only if source not NULL? - 04-12-2006 , 07:42 PM






Hello ralekel (AT) comcast (DOT) net,


If both these datasets are in tables why not use TSQL? It will be far easier
and quicker.

If this cannot be achieved then can you explain a little bit more about your
situation?

Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

Quote:
I'm trying to use a data driven query to update a destination table
with overrides imposed by another table. This override table contains
some records where only certain columns are overriden. Columns I do
not
wish to override for a particular record are left NULL.
Is there a simple way I can use a DDQT to write a single update that
will only update the destination column if the source column is not
NULL?
Thanks




Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: DTS Data Driven Query - Update column only if source not NULL? - 05-04-2006 , 12:59 PM



Allan,
Thanks. I don't know what T-SQL is. I was looking it up a bit. Would
this mean I could make SQL statements with a check before updating the
column?

Can I execute T-SQL statements within a SQL Query task?

To elaborate on my problem...

Table movies

Title(PK) Rating Ranking
--------- ------ -------
Spiderman PG 4 Stars
LotR PG 5 Stars
Matrix I R 2 Stars


Table movies_override

Title(PK) Rating Ranking
--------- ------ -------
Matrix I <NULL> 4 Stars

After I populate the movies table, I want to have another DTS Task
update any values according to what is in the movies_override table. In
this case, I don't want to override the Matrix's Rating with a NULL,
just its ranking. I only want to update from my override table with
column values that are not NULL. I had originally planned on doing this
with a Data Driven Query Task. It sounds like there's a better way with
T-SQL?

Thanks
-Rob


Allan Mitchell wrote:
Quote:
Hello ralekel (AT) comcast (DOT) net,


If both these datasets are in tables why not use TSQL? It will be far easier
and quicker.

If this cannot be achieved then can you explain a little bit more about your
situation?

Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

I'm trying to use a data driven query to update a destination table
with overrides imposed by another table. This override table contains
some records where only certain columns are overriden. Columns I do
not
wish to override for a particular record are left NULL.
Is there a simple way I can use a DDQT to write a single update that
will only update the destination column if the source column is not
NULL?
Thanks



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.