Solved

Search field and replace two others

Posted on 2013-11-27
3
241 Views
Last Modified: 2013-11-27
This may be simple to all but just cant get my head around :(

I would like to search for a value in FA_COST_NOM and if found replace the values in both FA_DISP_NOM and FA_REVAL_NOM, all three fields are in the same FA_ACCOUNTS table.

i.e.

FA_COST_NOM    FA_DISP_NOM    FA_REVAL_NOM
11980                   11960                  11950

If 11980 is found change the other two fields to 11960 and 11950 respectively. There may be multiple records with 11980 in them.

Please help.
Regards
S
0
Comment
Question by:SimonJohnG
[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 17

Accepted Solution

by:
Chris Millard earned 500 total points
ID: 39680425
I'm on holiday at the moment, so don't have access to SQL, but something like:-

UPDATE FA_ACCOUNTS
SET FA_DISP_NOM = '11960', FA_REVAL_NOM = '11950'
WHERE FA_COST_NOM = '11980'

Open in new window

0
 

Author Closing Comment

by:SimonJohnG
ID: 39680455
Thank you so much, easy when you know how! Hopefully didnt take up too much of your holiday, anywhere nice?
S
0
 
LVL 17

Expert Comment

by:Chris Millard
ID: 39680475
:-) Indoors - trying to use up holiday allocation rather than losing it!
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Format Date fields 11 63
SQL - Curser to do an insert based on a select 2 29
point in time restore in SQL server 26 53
denied execute as 13 57
Audit has been really one of the more interesting, most useful, yet difficult to maintain topics in the history of SQL Server. In earlier versions of SQL people had very few options for auditing in SQL Server. It typically meant using SQL Trace …
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 an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

732 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