SQL amend data field to add network path

5 pts.
Tags:
SQL
SQL queries
I'm looking to amend an SQL data field. The database is dbo.CaseInfo the field is FilePath. Currently the data field says 20170618041_06292017_145141_01.asf. I need to add the new network path to have it look like this.
Z:20170618041_06292017_145141_01.asf
There are over 20,000 entries and I'm looking for a query that will pull the 201706 as the indication of what I'm changing so that I can move a month worth of files at a time and change each month as I go by altering the query.


Software/Hardware used:
SQL
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • carlosdl
    It appears to me that you need a fairly simple UPDATE statement, that uses the LEFT function to determine the rows you want to UPDATE.

    Something like this:

    UPDATE <your_table>
    SET filepath = 'the-path-you-want-to-add' + filepath
    WHERE LEFT(filepath,6) = '201706'
    85,390 pointsBadges:
    report
  • ToddN2000
    Is the only thing different the Z: being added? If so follow Carlosdl example and you should be fine
    135,305 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: