?
Solved

Need to rename files associated to sql records

Posted on 2011-10-03
4
Medium Priority
?
232 Views
Last Modified: 2012-05-12
We have a vended app that we are moving away from.  The system stores links to videos.  The vendor changed the file names to guids so they don't make sense if you look at them through windows explorer.  I found the translation table in the database.  Here is an example:

MediaElementID                        displayName
abcd123456789xxx                 vs TeamA

Any thoughts on how I can rename the files using this table?  Long shot but was curious if anyone had any thoughts.
0
Comment
Question by:martyuni
  • 3
4 Comments
 
LVL 7

Accepted Solution

by:
tlovie earned 2000 total points
ID: 36904072
use a select statement to create command lines, that you can copy and paste into a command window or script.

select 'ren "' + MediaElementID + '" "' +DisplayName + '"' from table

0
 

Author Comment

by:martyuni
ID: 36904096
Will give that a try, thanks tlovie
0
 

Author Comment

by:martyuni
ID: 36904315
I get the following error:

Msg 402, Level 16, State 1, Line 1
The data types varchar and uniqueidentifier are incompatible in the add operator.
0
 

Author Comment

by:martyuni
ID: 36904359
I figured it out, had to convert he guid to varchar.  Thanks for the help
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question