2013-11-20 383 views
8

,當我得到這個錯誤在我的SQL 2005方法的這一步:錯誤「命令的語法不正確」重命名文件

rename "G:\AuthorsList\AuthorsList_New.mdb""G:\AuthorsList\AuthorsListCopy.mdb" 

我試圖重命名文件。我也試過這個,並得到相同的錯誤:

rename "G:\AuthorsList\AuthorsList_New.mdb" "G:\AuthorsList\AuthorsListCopy.mdb" 

如何解決此錯誤?

+2

什麼是 「SL 2005」?您是否期望SQL Server重命名文件,就像在命令提示符下調用此文件一樣? –

+0

@AaronBertrand - 我更正了我的錯誤 - 它應該是SQL 2005.以上是三步SQL 2005 DTS包的最後一步。我正在使用操作系統(cmdexec)類型來運行程序包的此步驟。 – user2821300

+0

哪個錯誤?任何錯誤信息?你必須在SQL配置 – user2196728

回答

24

檢查的rename命令的文檔:

Syntax
rename [Drive:][Path]filename1 filename2

Parameters
[Drive:][Path]filename1 : Specifies the location and name of the file or set of files you want to rename.
filename2 : Specifies the new name for the file. If you use wildcards (* and ?), filename2 specifies the new names for the files. You cannot specify a new drive or path when renaming files.

第二個參數是不可能的,它應該只包含新的文件名的路徑:

rename "G:\AuthorsList\AuthorsList_New.mdb" AuthorsListCopy.mdb 
+0

中激活cmdexec來解決我的錯誤。非常感謝!! – user2821300