INSERT INTO
    global_sys_conf(objnam, varnam, value_, ent_id, dscrpt)
SELECT
    'PartialPasswordPolicy',
    'minLength',
    '(?=\S{8,})',
    {ent_id},
    'Minimalna długość hasła to 8 znaków'
WHERE
    NOT EXISTS (SELECT objnam FROM global_sys_conf WHERE objnam = 'PartialPasswordPolicy' AND varnam = 'minLength');

INSERT INTO
    global_sys_conf(objnam, varnam, value_, ent_id, dscrpt)
SELECT
    'PartialPasswordPolicy',
    'maxLength',
    '^(\S{0,15})$',
    {ent_id},
    'Maksymalna długość hasła to 15 znaków'
WHERE
    NOT EXISTS (SELECT objnam FROM global_sys_conf WHERE objnam = 'PartialPasswordPolicy' AND varnam = 'maxLength');

INSERT INTO
    global_sys_conf(objnam, varnam, value_, ent_id, dscrpt)
SELECT
    'PartialPasswordPolicy',
    'minNumber',
    '(?=(.*\d){1})',
    {ent_id},
    'Hasło musi zawierać co najmniej jedną cyfrę'
WHERE
    NOT EXISTS (SELECT objnam FROM global_sys_conf WHERE objnam = 'PartialPasswordPolicy' AND varnam = 'minNumber');

INSERT INTO
    global_sys_conf(objnam, varnam, value_, ent_id, dscrpt)
SELECT
    'PartialPasswordPolicy',
    'specialCharacter',
    '(?=\S*[\W])',
    {ent_id},
    'Hasło musi zawierać co najmniej jeden znak specjalny'
WHERE
    NOT EXISTS (SELECT objnam FROM global_sys_conf WHERE objnam = 'PartialPasswordPolicy' AND varnam = 'specialCharacter');

INSERT INTO
    global_sys_conf(objnam, varnam, value_, ent_id, dscrpt)
SELECT
    'PartialPasswordPolicy',
    'uppercaseLetter',
    '(?=\S*[A-Z])',
    {ent_id},
    'Hasło musi zawierać co najmniej jedną dużą literę'
WHERE
    NOT EXISTS (SELECT objnam FROM global_sys_conf WHERE objnam = 'PartialPasswordPolicy' AND varnam = 'uppercaseLetter');

INSERT INTO
    global_sys_conf(objnam, varnam, value_, ent_id, dscrpt)
SELECT
    'PartialPasswordPolicy',
    'lowercaseLetter',
    '(?=\S*[a-z])',
    {ent_id},
    'Hasło musi zawierać co najmniej jedną małą literę'
WHERE
    NOT EXISTS (SELECT objnam FROM global_sys_conf WHERE objnam = 'PartialPasswordPolicy' AND varnam = 'lowercaseLetter');