Solved

Update Multiple Records with Array of Values

Posted on 2010-11-28
3
238 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
  • 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 50 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

772 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