#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    1
    Rep Power
    0

    Firebird update field in table.


    I have a field in a table that contains paths to files, either on my C or on my I drive. I need a procedure to only update my paths for the I drive, f.e. from:

    I:\test\test2\test3\sample.mp3

    to

    II:\sample.mp3

    all pathnames can vary. The endresult should always be:

    II:\filename.

    Any ideas?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2006
    Location
    Plovdiv. Bulgaria
    Posts
    226
    Rep Power
    13
    Originally Posted by bvleer
    I have a field in a table that contains paths to files, either on my C or on my I drive. I need a procedure to only update my paths for the I drive, f.e. from:

    I:\test\test2\test3\sample.mp3

    to

    II:\sample.mp3

    all pathnames can vary. The endresult should always be:

    II:\filename.

    Any ideas?
    That's easy.
    Code:
    UPDATE TABLE_NAME SET 
        FIELD_NAME = 'II:\' || RIGHT(FIELD_NAME, POSITION('\' IN REVERSE(FIELD_NAME))-1) 
    WHERE     
        UPPER(FIELD_NAME) STARTING WITH 'I:\'

IMN logo majestic logo threadwatch logo seochat tools logo