SQL 用密码备份

SQL backup with password

我尝试使用以下脚本备份数据库:

BACKUP DATABASE Northwind 
TO DISK='C:\Northwind.BAK' 
WITH MEDIAPASSWORD='my_password' 

但我收到此错误:

One or more of the options (mediapassword) are not supported for this statement. Review the documentation for supported options.

如果您check the documentation(如错误消息所示),那么您会看到:

Security

Beginning with SQL Server 2012, the PASSWORD and MEDIAPASSWORD options are discontinued for creating backups. It is still possible to restore backups created with passwords.