Solved

Help with Import Wizard

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

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 60

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

617 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