SQL Server – How create a function

CREATE FUNCTION dbo.MyFunction (@input VARCHAR(200))
RETURNS VARCHAR(200)
AS BEGIN
    DECLARE @WebSite VARCHAR(250)

    SET @WebSite = @Input
    SET @WebSite = REPLACE(@WebSite , 'https://', '')
    SET @WebSite = REPLACE(@WebSite , 'http://', '')
    SET @WebSite = REPLACE(@WebSite , '.com', '')
    SET @WebSite = REPLACE(@WebSite , 'www.', '')

    RETURN @WebSite 
END

Leave a Comment

Your email address will not be published. Required fields are marked *