Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple updates in DTS 1

Status
Not open for further replies.

BuGlen

MIS
Jun 16, 2000
254
US
I have this update query in my DTS package to null out blank values:

-----
update catalog_import
set vendor_sku = null
where vendor_sku < '!'
update catalog_import
set vendor_desc_text = null
where vendor_desc_text < '!'
update catalog_import
set uom = null
where uom < '!'
update catalog_import
set product_type = null
where product_type < '!'
update catalog_import
set product_url = null
where product_url < '!'
update catalog_import
set stock_status = null
where stock_status < '!'
-----
As you can see, all the updates are for one table. Is there a better way to express these multiple updates into a single update statement?

TIA for any help.

- Glen

Know thy data.
 
This should do the trick, I think. Good luck!

update catalog_import
set vendor_sku =
CASE WHEN vendor_sku < '!'
THEN null ELSE vendor_sku END
, vendor_desc_text =
CASE WHEN vendor_desc_text < '!'
THEN null ELSE vendor_desc_text END
..etc...
, stock_status =
CASE WHEN stock_status < '!'
THEN null ELSE stock_status END


--Angel [rainbow]
-----------------------------------
Every time I lose my mind, I wonder
if it's really worth finding.
 
Thank you Angel! I knew there must be a better way, but my SQL experience is limited (still learning). :~)- I'll give this and post the results.

- Glen

Know thy data.
 
OK, works perfectly. Thanks again Angel!

- Glen

Know thy data.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top