Friday, March 23, 2012

Rename Files using sql/t-sql

Is it posssible to rename files using SQL/T-SQL? One method could be the xp_cmdshell command but I want to rename files on the netowrk and xp_cmdshell commands do not support UNC paths.
Any ideas?
ThanksOriginally posted by vmlal
Is it posssible to rename files using SQL/T-SQL? One method could be the xp_cmdshell command but I want to rename files on the netowrk and xp_cmdshell commands do not support UNC paths.

Any ideas?

Thanks

This works fine:

xp_cmdshell 'copy \\server1\backup\backup.sql \\server1\backup\backup2.sql'

xp_cmdshell 'copy \\server1\backup\backup.sql \\server2\backup\backup2.sql'|||you can create a bat file on your local machine in which you can enter all your commands. You can then execute this with the xp_cmdshell.

No comments:

Post a Comment