Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    212

    Unanswered: 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?

    Thanks

  2. #2
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621

    Re: Rename Files using sql/t-sql

    Originally 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'

  3. #3
    Join Date
    Dec 2002
    Location
    Antwerp, Belgium
    Posts
    227
    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.
    Johan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •