Solved

changing descriptions

Posted on 2012-03-10
8
264 Views
Last Modified: 2012-08-13
I have been given a field that I need to change a description from

Economy Funerals NSW Asset Purchases Cle
to
Value Funerals NSW Asset Purcashes Cle

There are over 500 entries, I need to change the word Economy to Value
what is the sql syntax to do this.
0
Comment
Question by:Amanda Walshaw
[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
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 37

Expert Comment

by:Neil Russell
ID: 37705777
UPDATE table
SET fieldname = "Value Funerals NSW Asset Purcashes Cle"
WHERE fieldname = "Economy Funerals NSW Asset Purchases Cle"
0
 
LVL 37

Expert Comment

by:Neil Russell
ID: 37705780
where the word table needs to e the name of your table and the word fieldname needs to be the name of the field your changing
0
 
LVL 25

Expert Comment

by:jogos
ID: 37706440
See update of Neilsr, but with building an update always try if your where-clause is correct by trying it in a select. OK here it looks as if it is very specific, but a good habbit makes you won't get surprised by an update where you forgot a crucial filter.

select * from table
WHERE fieldname = "Economy Funerals NSW Asset Purchases Cle"
0
Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

 

Author Comment

by:Amanda Walshaw
ID: 37706682
no sorry there are over 500 of the chart of accounts all different descriptions
example of number of descriptions
Economy Funerals NSW Trade Debtors Colle
Economy Funerals NSW Plant & Equipment I
Economy Funerals NSW Asset Sale Proceeds
Economy Funerals NSW Asset Purchases Cle
Economy Funerals NSW Prov Depr - Plant &
Economy Funerals NSW Accrued Charges Inv
Economy Funerals NSW Preservation InvoCa
Economy Funerals NSW Electronic Notices

To

Value Funerals NSW Trade Debtors Colle
Value Funerals NSW Plant & Equipment I
Value Funerals NSW Asset Sale Proceeds
Value Funerals NSW Asset Purchases Cle
Value Funerals NSW Prov Depr - Plant &
Value Funerals NSW Accrued Charges Inv
Value Funerals NSW Preservation InvoCa
Value Funerals NSW Electronic Notices
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 37707211
A small variation (no points please):
UPDATE YourTableName
SET YourColumnName = REPLACE(YourColumnName, 'Economy', 'Value')
WHERE fieldname LIKE 'Economy Funerals NSW%'
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 500 total points
ID: 37707212
This should be a safer:
UPDATE YourTableName
SET YourColumnName = 'Value' + SUNSTRING(YourColumnName, 8, LEN(YourColumnName) - 7)
WHERE fieldname LIKE 'Economy Funerals NSW%'
0
 

Author Comment

by:Amanda Walshaw
ID: 37707449
UPDATE YourTableName
SET YourColumnName = 'Value' + SUNSTRING(YourColumnName, 8, LEN(YourColumnName) - 7)
WHERE fieldname LIKE 'Economy Funerals NSW%'

note sunstring is not recognizable, i think you mean substring


i
0
 

Author Closing Comment

by:Amanda Walshaw
ID: 37707450
worked well
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

717 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