[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Update Multiple Records with Array of Values

Posted on 2010-11-28
3
Medium Priority
?
242 Views
Last Modified: 2012-08-13
Hi,

I found the update query structure on another post, and wanted to confirm this syntax will work.  I am expecting to only update the field DESCR for 3 records in the example given.   Does this look ok?



UPDATE IM_ITEM

SET DESCR =

CASE  ITEM_NO
               
                WHEN '1000029707' THEN 'APPLES CUYAMA'
            WHEN '1000007698' THEN 'APPLES GINGR GOLD ORGANIC'
            WHEN '1000007701' THEN 'APPLES GRNNY SMITH ORG'
 END

WHERE ITEM_NO IN ( '1000029707' , '1000007698' , '1000007701')
0
Comment
Question by:AD1080
[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
  • 2
3 Comments
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 34224413
The syntax seems to be right. Any error with it ?

Raj
0
 
LVL 23

Accepted Solution

by:
Rajkumar Gs earned 200 total points
ID: 34224421
'CASE' can be used as conditional. In your query, when ITEM_NO column have the value '1000029707', it will update DESCR column with  'APPLES CUYAMA' and so on

Raj
0
 

Author Closing Comment

by:AD1080
ID: 34224429
Hi,

No error.  Thanks for taking the time to confirm.  Just wanted to be 100% before updating a lot of records using this approach.
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

650 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