Showing posts with label xp_cmdshell. Show all posts
Showing posts with label xp_cmdshell. Show all posts

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.

Wednesday, March 21, 2012

rename a file without xp_cmdshell

Hi:

By default xp_cmdshell is disabled on new Installation of SQL Server 2005. I want to know how do I rename a file without using xp_cmdshell option?. What are my options programmatically to rename a file without using xp_cmdshell from T-SQL. One option is to create a Active x VB Script that uses the file system object to rename a file in a DTS package and then run the package.

Any ideas would be higly appreciated.

Thanks

Meher

you may use a CLR functions to achive such a requirement