I am trying to format the email address in my table by removing everything starting the @. Also I would like to replace the underscore with blank space.
For example:
[email protected]
I would like the above email to be changed like this:
FirstName LastName
Here is my code but this trims everything after the @ and that is what i want. But how can i replace the underscore with blank. I want all in one statement using the update function. How can I do that?
SELECT
left (Email, CHARINDEX('@',Email)-1)
FROM [Dashboard]
Thanks for the help
SELECT REPLACE(LEFT(Email, CHARINDEX('@',Email)-1),'_',' ')
FROM [DSR].[dbo].[RCA_Dashboard]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With