Solved

Help with Import Wizard

Posted on 2011-09-06
6
388 Views
Last Modified: 2012-05-12
OK....I have a table for my Products called "tblProduct".

That product has a column called 'SKU'.  I have added the column 'List_Price'

I have an Excel Spreadsheet that has two columns.  column 1 is SKU column 2 is list_price.

Can I use the import wizard to UPDATE the product table, but ONLY the column 'list_price' based on a where clause for the SKU field?

I've tried walking through the wizard, but I wasn't sure how to do that.

Please help

Thanks!
0
Comment
Question by:DCFC
  • 3
  • 2
6 Comments
 

Author Comment

by:DCFC
ID: 36492645
Yes, MySQL, not MS SQL Server.

0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 36492691
Sorry for the silly question. I am just use to mysqldbimport (or mysqlimport), which is a command line tool. However, navicat, EMS, and SQLMaestro provide import wizards, so maybe you are using one of them. Moving along to your question, I suspect that in any case the import is not conditional. You may need to import to a staging table and then from there use an UPDATE with a JOIN or use the REPLACE (or INSERT INTO ... ON DUPLICATE KEY) SQL syntax to accomplish what you want.
0
 

Author Comment

by:DCFC
ID: 36492723
Oh....OK, I can import to a staging table....but how would I write the UPDATE statement on the join?  Can you give me an example?
0
 
LVL 59

Assisted Solution

by:Kevin Cross
Kevin Cross earned 500 total points
ID: 36492828
No problem.

Say your staging table is tblProducts_Import with same structure as tblProducts, then you can do something like in the attached snippet(s).

UPDATE tblProduct AS tto, tblProducts_Import AS tfr
SET tto.list_price = tfr.list_price
WHERE tto.SKU = tfr.SKU
;

Open in new window


Or with ANSI join...
UPDATE tblProduct AS tto
JOIN tblProducts_Import AS tfr ON tto.SKU = tfr.SKU 
SET tto.list_price = tfr.list_price
;

Open in new window


Hope that helps!
0
 

Author Closing Comment

by:DCFC
ID: 36495970
Thanks so much for your help!  That worked perfect!  I imported to the staging table and then ran the update statement!  Thanks so much!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now