Solved

Update Multiple Records with Array of Values

Posted on 2010-11-28
3
240 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 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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
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.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

728 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