November 29, 2014 at 1:34 am
Hi,
There is email address in my datablse table column as username
I have to select it from database in such a way so that first two letter and last
two letters only visible before @
for example this email id (sontosh_kumar_rch@yahoo.com) should be selected in below format..
November 29, 2014 at 1:54 am
gouri92 (11/29/2014)
Hi,There is email address in my datablse table column as username
I have to select it from database in such a way so that first two letter and last
two letters only visible before @
for example this email id (sontosh_kumar_rch@yahoo.com) should be selected in below format..
Quick code snip, should get you passed this hurdle
😎
DECLARE @EMAIL_STR VARCHAR(30) = 'sontosh_kumar_rch@yahoo.com';
SELECT
@EMAIL_STR AS NORMAL_EMAIL
,STUFF(@EMAIL_STR,3, (CHARINDEX('@',@EMAIL_STR,1) - 5),REPLICATE(CHAR(46),(CHARINDEX('@',@EMAIL_STR,1) - 5))) AS DOTTED_EMAIL
;
Results
NORMAL_EMAIL DOTTED_EMAIL
------------------------------ ------------------------------
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply