CREATE OR REPLACE VIEW ObjectImagesExport AS
SELECT
    o.ItemType,
    i.Accession_Full_ID,
    o.ItemName,
    ObjectsImagesID,
    CONCAT_WS('/', REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(ImageFilePath, '\\', '/'), 'Y:/', ''), 'Y:', ''),
                                           '//Foyer/c/Images Mosaic/', ''), '//Foyer/c/Images Mosaic/', ''),
                           '//SERVER1/Images Mosaic/', ''), ImageFileName) AS ImagePath,
    ImageDescription,
    DisplayImage,
    DefaultImageIndicator

FROM ObjectsImages i
    JOIN Objects o ON (i.Accession_Full_ID = o.Accession_Full_ID)
WHERE TRIM(ImageFileName) <> ''
ORDER BY ObjectsImagesID;

CREATE OR REPLACE VIEW ObjectImagesExport AS
SELECT
    NULLIF(TRIM(o.ItemType), '')                              AS ItemType,
    NULLIF(TRIM(i.Accession_Full_ID), '')                     AS Accession_Full_ID,
    NULLIF(TRIM(o.ItemName), '')                              AS ItemName,
    NULLIF(TRIM(ObjectsImagesID), '')                         AS ObjectsImagesID,
    NULLIF(TRIM(CONCAT_WS('/', REPLACE(
        REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(ImageFilePath, '\\', '/'), 'Y:/', ''), 'Y:', ''),
                        '//Foyer/c/Images Mosaic/', ''), '//Foyer/c/Images Mosaic/', ''),
        '//SERVER1/Images Mosaic/', ''), ImageFileName)), '') AS ImagePath,
    NULLIF(TRIM(ImageDescription), '')                        AS ImageDescription,
    NULLIF(TRIM(DisplayImage), '')                            AS DisplayImage,
    NULLIF(TRIM(DefaultImageIndicator), '')                   AS DefaultImageIndicator

FROM ObjectsImages i
    JOIN Objects o ON (i.Accession_Full_ID = o.Accession_Full_ID)
WHERE TRIM(ImageFileName) <> ''
ORDER BY ObjectsImagesID;

Trim leading and trailing whitespace and replace blanks with null in ObjectImagesExport view
Trim leading and trailing whitespace and replace blanks with null in ObjectImagesExport view
