Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
niall29
Starting Member
5 Posts |
Posted - 2006-05-09 : 21:15:21
|
| I think this one will take a bit of thinking but this is what I am trying to do.I have a database which I got alot of help from here with when I was creating it over a 2years ago attached to a VB6 App.This was an App to keep track of employees (their attendance, position,deviations, remarks, etc)I have discovered that managers have been putting phone numbers in that they caught employees calling. I have been told that because alot of supervisors(roughly about 100) have access to this info I should remove the area code from the phone numbers.My question is how can I check a column which is a varchar (1000)field for 10 digits together and then remove or XXX out 3 digits.Any help will be highly appreciated.Thanks in advance |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-05-09 : 21:42:39
|
| All ur info are not needed to be considered eg1. Supervisors ? does it matter ? What if they are managers ? eg2. 100 supervisors ? Something different is done if # of supervisors is 10 ?do u know a function called RIGHTPrint Right(9051234567,7) ==> 1234567to remove permanantly ? Its as if all data is deleted, because there will not be any use of those data after removing a part of it !!Srinika |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2006-05-09 : 21:56:47
|
| if the number is anywhere within the string, check out STUFFor if you want to do it the hard way, do substring and replaceHTH--------------------keeping it simple... |
 |
|
|
niall29
Starting Member
5 Posts |
Posted - 2006-05-10 : 00:18:25
|
| Sriniki,I do know the RIGHT function but how do I get it to search the whole string value and only remove 3 digits or all the digits if it finds 10 numbers together. There is alot of info in this field but I only want to change or remove the phone number (10 digits).Maybe it makes perfect sense to you but a question is only easy if you know the answer. and sorry for going into so much detail.Jen.I was thinking about replace but how do I get it to recognise 10 wild numeric characters. Thanks for trying to help |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
niall29
Starting Member
5 Posts |
Posted - 2006-05-10 : 09:00:32
|
| Jen and Midhivanan Thank you for your help this will really help. |
 |
|
|
|
|
|