it is working……
declare @dbName varchar(50)
set @dbName='myDb'
BACKUP DATABASE @dbName TO DISK = 'c:\backup\myDb.bak'
But
Why is it not working? where as both are similar query.
BACKUP DATABASE 'mydb' TO DISK = 'c:\backup\myDb.bak'
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The documentation says:
So it takes a database name (f.e.
mydb) or a variable (f.e.@dbname.) But not a string literal (f.e.'mydb'.)Just omit the quotes to change the string literal to a database name: