Tweeted twitter.com/StackDBAs/status/786606800091156482
2 added 2 characters in body
source | link

I have this type of values in table column

154646@8@486
45465@6464@654

etc.

How can i remove everything after second @ character ? I need to display

154646@8
45465@6464

I can do it only for all @ but not for bothsecond

SELECT REPLACE(LEFT('45@Tra@lala', CHARINDEX('@','45@Tra@lala')-1),'_',' ')

returns 45 but not 45@Tra

Thank you :-)

I have this type of values in table column

154646@8@486
45465@6464@654

etc.

How can i remove everything after second @ character ? I need to display

154646@8
45465@6464

I can do it only for all @ but not for both

SELECT REPLACE(LEFT('45@Tra@lala', CHARINDEX('@','45@Tra@lala')-1),'_',' ')

returns 45 but not 45@Tra

Thank you :-)

I have this type of values in table column

154646@8@486
45465@6464@654

etc.

How can i remove everything after second @ character ? I need to display

154646@8
45465@6464

I can do it only for all @ but not for second

SELECT REPLACE(LEFT('45@Tra@lala', CHARINDEX('@','45@Tra@lala')-1),'_',' ')

returns 45 but not 45@Tra

Thank you :-)

1
source | link

Remove string after second specific character occures from left

I have this type of values in table column

154646@8@486
45465@6464@654

etc.

How can i remove everything after second @ character ? I need to display

154646@8
45465@6464

I can do it only for all @ but not for both

SELECT REPLACE(LEFT('45@Tra@lala', CHARINDEX('@','45@Tra@lala')-1),'_',' ')

returns 45 but not 45@Tra

Thank you :-)