Solved

Combining two update queries

Posted on 2008-10-16
7
145 Views
Last Modified: 2010-04-21
Hi,
Can anybody help me....I have data in a column which contain:
Fulltime
Fultime
Fulltime
Partime
Partime

Now I want to change all fulltime words with Waiting and partime words with Placed.

Do you know how to do this?
0
Comment
Question by:Dhehien
[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
  • 4
  • 2
7 Comments
 
LVL 14

Expert Comment

by:Binuth
ID: 22729924
try this
update tableName
	set ColName = case when ColName= 'Fulltime' then 'Waiting' 
				 else
					case when ColName= 'Partime' then 'Placed' end
				end

Open in new window

0
 
LVL 6

Expert Comment

by:divyeshhdoshi
ID: 22729957
update <tablename>
set <columnname> =
                      case <columnname>
                               when 'Fulltime' then 'Waiting' when 'Partime' then 'Placed'
                      End
0
 

Author Comment

by:Dhehien
ID: 22730004
It doesn't work, it says "cannot update (column_name) to null"
0
Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

 
LVL 14

Accepted Solution

by:
Binuth earned 500 total points
ID: 22730026
hmm.. your column not allow null values...
try now

update tableName
        set ColName = case when ColName= 'Fulltime' then 'Waiting' 
                                 else
                                        case when ColName= 'Partime' then 'Placed' else ColName  end
                                end

Open in new window

0
 

Author Comment

by:Dhehien
ID: 22730057
Thanks heaps, It works!!!!
0
 

Author Closing Comment

by:Dhehien
ID: 31506680
Awesome
0
 

Author Comment

by:Dhehien
ID: 22730540
Hi...the data in the column that just  changed was created from other table, apparently it also change the original data. Is there anyway to avoid this?
0

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

696 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