Last active
May 20, 2019 01:05
-
-
Save ArCiGo/e8b0328765f9859afdc2efc4eb468e15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IF EXISTS(SELECT 1 FROM sys.objects WHERE name = 'StripWWWandCom') | |
DROP PROC StripWWWandCom | |
GO | |
CREATE FUNCTION StripWWWandCom( | |
@pInput VARCHAR(250) | |
) | |
RETURNS VARCHAR(250) | |
AS | |
BEGIN | |
DECLARE @WORK VARCHAR(250) | |
SET @WORK = @pInput | |
SET @WORK = REPLACE(@WORK, 'www.', '') | |
SET @WORK = REPLACE(@WORK, '.com', '') | |
RETURN @WORK | |
END | |
DECLARE @vWebSite VARCHAR(MAX) | |
SET @vWebSite = 'www.google.com' | |
SELECT dbo.StripWWWandCom(@vWebSite) | |
/** Output **/ | |
--------------------------------------- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment