What are the challenges you face when working across database platforms? Take the survey

problem using COPYTO parameter

Daniel HandleyDaniel Handley Posts: 214
edited February 25, 2005 10:01AM in SQL Backup Previous Versions
There are a couple of items that could cause this.

The first is in the syntax that you are using.
With the COPYTO option you need to use two single quotes rather than a single double quote. This is an easy mistake as when looking at the examples it looks like a double quote. Also there should be no comma after the COPYTO option.
Your script should read.
master..sqlbackup '-SQL "BACKUP LOG [Northwind2] TO DISK = ''d:\sql2000\MSSQL\BACKUP\<AUTO>'' WITH NAME = ''Database (Northwind2), 25/02/2005 3:02:01 PM'', DESCRIPTION = ''Backup on 25/02/2005 3:02:01 PM Database: Northwind2 Instance: (local) Server: SGSINSRV04'', COMPRESSION = 1, COPYTO = ''D:\TEST\'' " -U sa -P xxxx'
Copy this script into a text editor and you can see the difference.

The second issues that could cause a problem is one of rights, especially if you intend to copy to a remote drive. The user running the script must have permission to write to the copy to location.

Daniel Handley
Red Gate Software Ltd
Sign In or Register to comment.