[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Remove "(xxx)" from the field

Posted on 2007-07-24
4
Medium Priority
?
176 Views
Last Modified: 2010-03-20
I would like to update my records to stripped off the "(xxxxx)"from each record on a field in my table
For ex
US(Wash)  >> US
Can(ONT)>>> CAN
Mex(AcA)>>> Mex
0
Comment
Question by:zachvaldez
  • 2
  • 2
4 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 19562579
Hello zachvaldez,

What db platform?  Access:

UPDATE YourTable
SET SomeField = Left(SomeField, InStr(1, SomeField, "(") - 1)

SQL SERVER:

UPDATE YourTable
SET SomeField = LEFT(SomeField, CHARINDEX('(', SomeField) - 1)


Regards,

Patrick
0
 

Author Comment

by:zachvaldez
ID: 19562647
its sql 2000.
Also If I have a  record like
US Book-History,I would like to change it to  read w/o the "-" as

US Book History
thanks
0
 
LVL 93

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 500 total points
ID: 19562691
zachvaldez,

UPDATE YourTable
SET SomeField = REPLACE(LEFT(SomeField, CHARINDEX('(', SomeField) - 1), '-', '')


Regards,

Patrick
0
 

Author Comment

by:zachvaldez
ID: 19571384
perfect!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

864 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