backup from sqlcmd problem

ernesternest Member Posts: 162
Hi all

The following script in SQL Management Studio it is working correctly:

BACKUP DATABASE "Navision Demo Database (4-0)"

TO DISK = 'C:\Backup\NAV\backup.bak'

Processed 10568 pages for database 'Navision Demo Database (4-0)', file 'Navision Demo Database (4-0)_Data' on file 1.

Processed 2 pages for database 'Navision Demo Database (4-0)', file 'Navision Demo Database (4-0)_Log' on file 1.

BACKUP DATABASE successfully processed 10570 pages in 0.389 seconds (222.579 MB/sec).



Meanwhile from SQLCMD I am having the following message:

C:\Backup>sqlcmd

1> BACKUP DATABASE "Navision Demo Database (4-0)" TO DISK = 'C:\Backup\NAV\backu

p.bak'

2> go

Msg 102, Level 15, State 1, Server NAVISIONSRV, Line 1

Incorrect syntax near 'Navision Demo Database (4-0)'.

1> BACKUP DATABASE 'Navision Demo Database (4-0)' TO DISK = 'C:\Backup\NAV\backu

p.bak'

2> go

Msg 102, Level 15, State 1, Server NAVISIONSRV, Line 1

Incorrect syntax near 'Navision Demo Database (4-0)'.

1>


Any suggestions for this issue??

Best Regards
Ernest

Comments

  • DenSterDenSter Member Posts: 8,305
    I haven't used sqlcmd myself, but you probably need to connect to the server first. When you open SSMS, it connects to the server first, and then when you issue the BACKUP command, it already knows where to look. Take a look at books online for more information about sqlcmd, it'll explain what to do.
Sign In or Register to comment.