clear markdown compare help best fiddles feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3601530 fiddles created (47954 in the last week).

CREATE TABLE #Mail( [Name] [nvarchar](50) NOT NULL, [Surname] [nvarchar](50) NOT NULL, [Email_adress] [nvarchar](500) NULL, ) ON [PRIMARY];
 hidden batch(es)

INSERT INTO #Mail ( [Name], [Surname], [Email_adress]) VALUES ('Mary', 'Green', ''), ('Lory', 'Red', ''), ('John', 'Yellow', ''), ('Susan', 'De Blue', '');
4 rows affected
 hidden batch(es)

SELECT *,CHARINDEX('@',[Email_adress]) AS [Position], LEFT([Email_adress],CHARINDEX('@',[Email_adress])-1) AS [Mail_username] FROM #Mail
Name Surname Email_adress Position Mail_username
Mary Green 11
Lory Red 5 lory
John Yellow 9 j.yellow
Susan De Blue 5 susy
 hidden batch(es)