473,395 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Masking values in tables

4
I've a table with a field called 'Subscriber_ID" of 9 alph/numberic characters in MS Access. I would like to create an update query to update this field with the first 5 characters with ***** and last four characters as alpha/numeric.

So if run this update query it should update 123456789 to *****6789

Could someone tell me how could I do this? I would really appriciate it. Thanks!
Nov 16 '06 #1
12 1608
Killer42
8,435 Expert 8TB
I've a table with a field called 'Subscriber_ID" of 9 alph/numberic characters in MS Access. I would like to create an update query to update this field with the first 5 characters with ***** and last four characters as alpha/numeric.
So if run this update query it should update 123456789 to *****6789
Could someone tell me how could I do this? I would really appriciate it. Thanks!
This is untested, but may be some help...
Expand|Select|Wrap|Line Numbers
  1. UPDATE Table1 SET Table1.Subscriber_ID = "*****" 
  2. & Mid$("Subscriber_ID",6);
  3.  
Nov 16 '06 #2
NeoPa
32,556 Expert Mod 16PB
This should work perfectly.
Some (fussy) recommendations :
It's a good idea to use apostrophes (') for string delimiters within SQL where possible.
String versions of functions (Mid$, Format$) are no longer recommended. Use Mid instead.
Table qualifier unnecessary within a single table query (Field instead of Table.Field). Some people prefer to use it anyway - it's merely a style thing.
Nov 16 '06 #3
taa145
4
Thanks guys, I will try and hopefully it will work!
Nov 17 '06 #4
Killer42
8,435 Expert 8TB
This should work perfectly.
Some (fussy) recommendations :
It's a good idea to use apostrophes (') for string delimiters within SQL where possible.
Ok. Is that just to prevent conflicts when buildinmg strings in VB/VBA, or what?
String versions of functions (Mid$, Format$) are no longer recommended. Use Mid instead.
Yeah, I'm just a bit old-fashioned that way.
Table qualifier unnecessary within a single table query (Field instead of Table.Field). Some people prefer to use it anyway - it's merely a style thing.
I would normally leave it out, too. But I tend to use the Access GUI to generate SQL, and it likes to include them. At a guess, I probably stripped out a lot of parentheses before posting - Access just can't get enough of them, too.
Nov 17 '06 #5
NeoPa
32,556 Expert Mod 16PB
Ok. Is that just to prevent conflicts when buildinmg strings in VB/VBA, or what?
No.
The real reason is that the ANSI standard for SQL string delimiters is actually the (') and not the (") and some SQL engines won't even recognise the ("). I have my SQL Server set to comply strictly with the ANSI standards so it doesn't. I find it's good practice.
But isn't the side-effect nice. Strings within strings are now very rarely the problem they used to be for me.
Nov 17 '06 #6
taa145
4
Man you guys are awsome. The solution worked the way i wanted with a little change. Here's how I am updading my records.

UPDATE IDCD_OUTBOUND_ORIG SET IDCD_OUTBOUND_ORIG.PRINT_MEMBER_ID = "*****" & Mid$([PRINT_MEMBER_ID],6)
WHERE (((IDCD_OUTBOUND_ORIG.GROUP_ID)="55657607"));
Nov 18 '06 #7
PEB
1,418 Expert 1GB
One suggestion:

Try not to use **** as symbols in your field! This will affect in problems doing Like criterias!

If there is a mask... The meaning of the mask is to cache some value behind...

Appears **** but behind to be 1234

So if you want this to be a real mask you need to touch to the mask properties of the respectif field in a table
Nov 18 '06 #8
NeoPa
32,556 Expert Mod 16PB
I think there may be a misunderstanding here PEB - check out the first post.
The "****" is for obscuring secure information.
Nov 18 '06 #9
PEB
1,418 Expert 1GB
Yeah i understan that this is isn't a topic just for the masks
but instaed
Masking values in tables
Should be filling values in tables with ****

;)
Nov 18 '06 #10
Killer42
8,435 Expert 8TB
Yeah i understan that this is isn't a topic just for the masks
but instaed
Masking values in tables
Should be filling values in tables with ****

;)
I'd agree in general that masking should be done on display, rather than stored in the data. But if they really want to store it that way, it's their choice. However...

I would strongly recommend using some character other than the asterisk, if you can get away with it. Asterisks in your data are likely to cause all sorts of problems and confusion if you ever need to do wildcard type searches - that is, using the Like comparison. Because the asterisk has a special meaning in that case. As do some other characters, such as... um... question mark, I think. Check the online help for "Like", anyway.

Also, you might want to keep in mind NeoPa's recommendation to use single rather than double quotes. In other words, rather than
Expand|Select|Wrap|Line Numbers
  1. UPDATE IDCD_OUTBOUND_ORIG SET IDCD_OUTBOUND_ORIG.PRINT_MEMBER_ID = 
  2. "*****" & Mid$([PRINT_MEMBER_ID],6)
  3. WHERE (((IDCD_OUTBOUND_ORIG.GROUP_ID)="55657607"));
you could use
Expand|Select|Wrap|Line Numbers
  1. UPDATE IDCD_OUTBOUND_ORIG SET IDCD_OUTBOUND_ORIG.PRINT_MEMBER_ID =
  2. '*****' & Mid$([PRINT_MEMBER_ID],6)
  3. WHERE (((IDCD_OUTBOUND_ORIG.GROUP_ID)='55657607'));
(Urg - the highlighting didn't work very well, did it?)
Nov 19 '06 #11
Killer42
8,435 Expert 8TB
Sorry, I overlooked the fact that PEB already pointed out the problem with Like.
Nov 19 '06 #12
taa145
4
Thanks guys for all your suggestions!
Nov 23 '06 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ginchy | last post by:
I have uploaded a small 3 page web using MS Publisher 2003 and after uploading I switched on url masking to cloak the url. I am certain that it worked fine. I simply changed the colour scheme...
6
by: Stefan Kowalski | last post by:
Hi Newsgroup Does anyone here care to share their thoughts/experiences with using masking? I am storing categories of books which libraries stock, so that I might have codes: 015-000-000 =...
0
by: Dana Epp | last post by:
I have a ToolBarButton that when I set it to disabled (button.Enabled = false;) causes a really ugly gray masking effect to take place. This is normal and the intended way of the button, but I...
1
by: NBB | last post by:
I can't figure this one out. Here's the situation, should be pretty for the pros in here. I have a ListBox that is populated with the DataTextField and DataValueField flags of the DataSet....
9
by: Daniel Smedegaard Buus | last post by:
Hey all :) I was wondering about the $error_types (I particularly notice the 's' suffix when reading the manual) parameter for 'set_error_handler()': Can be used to mask the triggering of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.