?
Solved

Combining two update queries

Posted on 2008-10-16
7
Medium Priority
?
146 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
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 
LVL 14

Accepted Solution

by:
Binuth earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This article will show, step by step, how to integrate R code into a R Sweave document
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

770 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