Solved

Access 2003, Update Query is killing my text

Posted on 2009-03-31
3
256 Views
Last Modified: 2013-11-27
I have a field called [QPR/QPI Number] in a table called  SkpiUpdate.
I need to clean all the special characters from the field.

However when I run the below Update query it clears out many of fields from the record set.
Currently there are 93 fields that are NULL in this field after I run the query there are 134 NULL records.

All I am trying to do is remove the "-" from a couple of the records. The field is a text field. Mostly all numbers though. (Which is fine)

Here is my SQL: ( I use this in another area and it works fine)
UPDATE SkpiUpdate SET SkpiUpdate.[QPR/QPI Number] = Replace(Mid([QPR/QPI Number],8),"-","");
0
Comment
Question by:ggodwin
3 Comments
 
LVL 5

Expert Comment

by:defi0
ID: 24030854
If your field contains a value but does not contain a '-' after the 7th character, it will indeed be nullified. You should first test that Mid([QPR/QPI Number],8) contains a dash. Also, is it normal that it gets rid of the first character in all cases?
0
 

Author Comment

by:ggodwin
ID: 24030933
Is there easier way to just remove all the "-"?
Now that I think about it. I am not sure where this query came from?
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 250 total points
ID: 24030987
Your query is stripping first 7 chars and replacing all - from 8th character

Does that ring any bells?

If u just want to remove the dashs, you can just use replace without using the mid


update mytable set myfield = replace(myfield,"-","")

be warned, it will remove ALL occurrences. It may not be what you want. Before big changes, its recommended to backup db
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
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.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

863 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

25 Experts available now in Live!

Get 1:1 Help Now