1

Im trying to do backups to an azure blob storage that have the date when the backup is made, that way the job does not fail when the backup is generated with the same name, I am concatenating convert(varchar(500),GetDate(),112) + '.bak') but im getting the next error in the job execution

Incorrect syntax near '+'. [SQLSTATE 42000] (Error 102). The step failed.

The script:

Backup database model to url = 'https:containerurl/azurecontainer/model' + convert(varchar(500),GetDate(),112) + '.bak') go

asked Apr 16, 2020 at 20:19
0

2 Answers 2

1

You can't do concatenation in the backup command. But you can have a variable for the file name, so construct the file name first into the variable and use that variable in the backup command.

answered Apr 16, 2020 at 20:27
0

Or just turn on Soft Delete on the Storage Account.

The overwritten backups will continue to be available for a configurable retention period. - user126936

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.