CREATE OR REPLACE FUNCTION dbo.sequence_current(IN par_table character varying)
RETURNS bigint
AS
$BODY$
BEGIN
    /*
    [7904 - Severity CRITICAL - Unable to convert system object SYS.SEQUENCES. Perform a manual conversion.]
    RETURN (SELECT CAST(current_value AS bigint) FROM sys.sequences WHERE name = (@table + 'Sequence')) - 1;
    */
    -- RETURN (SELECT currval(concat(par_table, 'Sequence')));
    RETURN (SELECT nextval(concat(par_table, 'Sequence')));
    BEGIN
    END;
END;
$BODY$
LANGUAGE  plpgsql VOLATILE;