Issue with update statement

  • I have a column where it has all report names with the paths in the database

    For example - the path shows as /DEV/Reports/DEV/Reports/Folder Name/Report Name

    Now I want to update these tables for 230 rows that has different path names but same /DEV/Reports/DEV/Reports/Folder Name until folder name

    except report name complete path is same as it is..
    now I want to remove /DEV/Reports from all the rows as it is duplicated twice

    Is there a query to do? instead of doing one by one?

  • mcfarlandparkway - Tuesday, September 19, 2017 5:00 PM

    I have a column where it has all report names with the paths in the database

    For example - the path shows as /DEV/Reports/DEV/Reports/Folder Name/Report Name

    Now I want to update these tables for 230 rows that has different path names but same /DEV/Reports/DEV/Reports/Folder Name until folder name

    except report name complete path is same as it is..
    now I want to remove /DEV/Reports from all the rows as it is duplicated twice

    Is there a query to do? instead of doing one by one?

    Confused.  Perhaps an example or two of what you are trying to accomplish.

  • Example  -

    ReportID     path
    101           /DEV/Reports/DEV/Reports/FOlderName/ReportName1
    210           /DEV/Reports/DEV/Reports/FOlderName/ReportName2
    303            /DEV/Reports/DEV/Reports/FOlderName/ReportName3
    404            /DEV/Reports/DEV/Reports/FOlderName/ReportName4

    Like this i have total 70 reports that have incorrect path
    I need to update to the correct path like this below

    ReportID     path
    101           /DEV/Reports/FOlderName/ReportName1
    210           /DEV/Reports/FOlderName/ReportName2
    303            /DEV/Reports/FOlderName/ReportName3
    404           /DEV/Reports/FOlderName/ReportName

  • mcfarlandparkway - Tuesday, September 19, 2017 5:17 PM

    Example  -

    ReportID     path
    101           /DEV/Reports/DEV/Reports/FOlderName/ReportName1
    210           /DEV/Reports/DEV/Reports/FOlderName/ReportName2
    303            /DEV/Reports/DEV/Reports/FOlderName/ReportName3
    404            /DEV/Reports/DEV/Reports/FOlderName/ReportName4

    Like this i have total 70 reports that have incorrect path
    I need to update to the correct path like this below

    ReportID     path
    101           /DEV/Reports/FOlderName/ReportName1
    210           /DEV/Reports/FOlderName/ReportName2
    303            /DEV/Reports/FOlderName/ReportName3
    404           /DEV/Reports/FOlderName/ReportName

    Looks like a simple replace:  replace(path,'/DEV/Reports/DEV/Reports','/DEV/Reports')

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply