Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
pnpsql
Posting Yak Master
246 Posts |
Posted - 2011-08-06 : 02:08:14
|
| hi all, i have some files in folder and each file name contains some text that i want to remove such as : dbo.filename.storedprocedure.sql i do not want to use ssis , please help me how can i remove unuseful text from file name from each file in that folder using stored procedure.thankschallenge everything |
|
|
jeffw8713
Aged Yak Warrior
819 Posts |
Posted - 2011-08-06 : 11:58:40
|
| Why would you want to do this using SQL? This is something that should be done at the OS level instead of trying to force SQL into renaming objects at the OS level.It can be done, but you have to use xp_cmdshell and build the appropriate command to rename the files.Instead of doing that, look at setting up Powershell and writing a powershell script to do the work. If that has to be called from SQL Server, then you can use an agent job to either run the powershell script directly (SQL Server 2008 and above), or call the script using Operating System Command in the agent job (SQL Server 2005 and below).Jeff |
 |
|
|
pnpsql
Posting Yak Master
246 Posts |
Posted - 2011-08-08 : 12:36:15
|
| thanks jeff ,at first sight when i see no code at ur answer then i think that wht the shit is this but when i read it whole i think that u r gr8...challenge everything |
 |
|
|
|
|
|