What SQL argument am I wrong?

Reference Information. I have both SQL2008 and SQL2012 installed on my machine. This led to the fact that only studio management for 2012 is working, and any number of attempts will not allow me to add a studio for 2008.

Problem: I now have a backup copy, which for verification reasons should be restored to the 2008 instance without the 2012 management studio in order to avoid infection, so I'm trying to start the recovery directly from the command line. I let the 2012 studio make the actual team for me, and now I'm trying to include it in the tooltip, but it will not work; and no amount of reading allows me to see the wrong argument. I understand that I probably missed something elemental, but please take a look at it anyway.

The command I'm trying to run is:

C:\Program Files\Microsoft SQL Server\100\Tools\Binn>SqlCmd -E -S SQL2008 "RESTORE DATABASE Basename FROM  DISK = N'D:\Folder\Backup.BAK' WITH  FILE = 1,  MOVE N'Base_Data' TO N'C:\Folder\Base.mdf',  MOVE N'Base_1_Data' TO N'C:\Folder\Base_1.ndf',  MOVE N'Base_2_Data' TO N'C:\Folder\Base_2.ndf',  MOVE N'Base_Log' TO N'C:\Folder\Base_3.LDF',  NOUNLOAD,  STATS = 5"

And the answer is quick: An unexpected argument. To come in '-?' for reference.

I don’t see how -E or -S can be wrong and the server can be the correct instance of 2008. I tried this without MOVE to see if there could be something there, but it gave the same result.

So can someone please download 2 by 4 my way to let me know what I'm doing wrong? thank you

+4
source share
2 answers

Maybe so?

C:\Program Files\Microsoft SQL Server\100\Tools\Binn>SqlCmd -E -S SQL2008 -Q "RESTORE DATABASE Basename FROM  DISK = N'D:\Folder\Backup.BAK' WITH  FILE = 1,  MOVE N'Base_Data' TO N'C:\Folder\Base.mdf',  MOVE N'Base_1_Data' TO N'C:\Folder\Base_1.ndf',  MOVE N'Base_2_Data' TO N'C:\Folder\Base_2.ndf',  MOVE N'Base_Log' TO N'C:\Folder\Base_3.LDF',  NOUNLOAD,  STATS = 5"
+1
source

It seems that the most common problem with this problem is copying and pasting from some other source, as mentioned in the comments in another answer. My problem was copying and pasting from this article:

http://www.howtogeek.com/50295/backup-your-sql-server-database-from-the-command-line/

, , . , , U-2014, "EN DASH". , .

0

All Articles