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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to select part of Mobile Number from digit ??

Author  Topic 

abhishek_kumar_rch
Starting Member

6 Posts

Posted - 2014-09-12 : 09:32:19
Hi,
There is column mobile_number in my table
I have to replace with star(*) to the middle six character from contact number of 10 digit.

For example
The Contact number is 9334459875
I have to display it as follows
93******75 first two digit and last two only.

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2014-09-12 : 10:01:13
[code]SELECT STUFF(ContactNumber,3,6,'******');[/code]That assumes the ContactNumber column is of character type. If it is numeric, you will need to cast it to a character type before using the stuff function.
Go to Top of Page
   

- Advertisement -