SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
CREATE FUNCTION [dbo].[to_varchar20] (@d varchar(255))
RETURNS varchar(20)
with execute as CALLER
    AS
    BEGIN
		declare @to_varchar varchar(20);
        set @d = replace(@d, '"', '');
		set @to_varchar = left(@d, 20);
			
		return (@to_varchar);
    END
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
