-- ============================================= -- Author: -- Create date: -- Description: -- ============================================= CREATE FUNCTION [dbo].[CodiceAgenteDirettiDi] ( -- Add the parameters for the function here @CodiceAgente varchar(6) ) RETURNS varchar(6) AS BEGIN -- Declare the return variable here RETURN REPLACE(REPLACE(@CodiceAgente,'S','0'),'I','0') END