Solved

Help with Import Wizard

Posted on 2011-09-06
6
389 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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 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

18 Experts available now in Live!

Get 1:1 Help Now