Skip to content

Instantly share code, notes, and snippets.

@b2977053
Last active December 13, 2019 09:58
Show Gist options
  • Save b2977053/9d15a3403798835a2c1b33cf1d73a2cd to your computer and use it in GitHub Desktop.
Save b2977053/9d15a3403798835a2c1b33cf1d73a2cd to your computer and use it in GitHub Desktop.
PRINT SUBSTRING('A-B-C-D-E-F', 3, 1); -- B
PRINT SUBSTRING('A-B-C-D-E-F', 3, 2); -- B-
PRINT SUBSTRING('A-B-C-D-E-F', 3, 3); -- B-C
--gmail.com
DECLARE @Email NVARCHAR(100);
SET @Email = '[email protected]';
PRINT SUBSTRING(@Email, ( CHARINDEX('@', @Email) + 1 ),( LEN(@Email) - CHARINDEX('@', @Email) )); -- gmail.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment