Solved

Combining two update queries

Posted on 2008-10-16
7
138 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
  • 4
  • 2
7 Comments
 
LVL 14

Expert Comment

by:Binuth
Comment Utility
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
Comment Utility
update <tablename>
set <columnname> =
                      case <columnname>
                               when 'Fulltime' then 'Waiting' when 'Partime' then 'Placed'
                      End
0
 

Author Comment

by:Dhehien
Comment Utility
It doesn't work, it says "cannot update (column_name) to null"
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 14

Accepted Solution

by:
Binuth earned 500 total points
Comment Utility
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
Comment Utility
Thanks heaps, It works!!!!
0
 

Author Closing Comment

by:Dhehien
Comment Utility
Awesome
0
 

Author Comment

by:Dhehien
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
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 be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now