Solved

Help with Import Wizard

Posted on 2011-09-06
6
392 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

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…
Introduction In this installment of my SQL tidbits, I will be looking at parsing Extensible Markup Language (XML) directly passed as string parameters to MySQL 5.1.5 or higher. These would be instances where LOAD_FILE (http://dev.mysql.com/doc/refm…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 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