sql脚本返回UPDATE SYSDEVICES

时间:2010-07-14 17:21:07

标签: sql sql-server

我正在执行此声明:

declare @path varchar(255), @mydb varchar(50)
SELECT @mydb = 'timeclockplus'
select @path = 'C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Backup\' + @mydb + '-' + convert(varchar(8),getdate(),112) + '.bak'
BACKUP DATABASE @mydb TO @path

并收到此错误:

Msg 3206, Level 16, State 1, Line 4
No entry in sysdevices for backup device 'C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Backup\timeclockplus-20100714.bak'. Update sysdevices and rerun statement.
Msg 3013, Level 16, State 1, Line 4
BACKUP DATABASE is terminating abnormally.

有谁知道发生了什么事?

1 个答案:

答案 0 :(得分:2)

糟糕

BACKUP DATABASE @mydb TO DISK =  @path