Update Query

matthewR
5StarLounger
Posts: 627
Joined: 03 Feb 2010, 15:02

Update Query

Post by matthewR »

I have a table that has a field "Region (By Cl County)" that has some data that needs changed. Some of the data should be "CR - Middle Market Central" but the data is showing "CR ? Middle Market Central". I want to change all the data that says "CR ? Middle Market Central" to "CR - Middle Market Central". How would I do this in an update query? Thanks for your help.

User avatar
HansV
Administrator
Posts: 78416
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Update Query

Post by HansV »

You could use the Replace dialog, but if you prefer to use an update query:

UPDATE [tblData] SET [Region (By Cl County)] = "CR - Middle Market Central"
WHERE [Region (By Cl County)]="CR ? Middle Market Central"


where tblData is the name of the table.
Best wishes,
Hans

User avatar
Timelord
4StarLounger
Posts: 504
Joined: 23 Jul 2010, 18:36
Location: Westlake, OHIO

Re: Update Query

Post by Timelord »

update tablename set region = replace
(region, 'CR ? Middle Market Central','CR - Middle Market Central')
Who will you Inspire today?

matthewR
5StarLounger
Posts: 627
Joined: 03 Feb 2010, 15:02

Re: Update Query

Post by matthewR »

Thank you. I used the GUI and put
Like * CR ? Middle Market Central" in the criteria
and
CR - Middle Market Central in the Update to

User avatar
HansV
Administrator
Posts: 78416
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Update Query

Post by HansV »

That should work, but be aware that it would also change "CR A Middle Market Central" or "CR 9 Middle Market Central" (or any character in place of ?) to "CR - Middle Market Central".

(Probably not a real problem)
Best wishes,
Hans