SQL Server: how to make the target file name different for each backup

Source: Internet
Author: User

Problem:

When backing up an SQL Server database, you can specify a file name. Suppose we need to back up data every day, and we want to back up different file names every day, for example, using the current date as the file name

 

My answer:

Use master
Go

Backup database [sampledatabase] to disk = n'd: \ backup \ '+Convert (nvarchar (10), getdate (), 112)+ '. Bak' with noformat, noinit, name = n' sampledatabase-full database backup', Skip, norewind, nounload, stats = 10
Go

By the author: Chen xizhang in 2009/7/15 10:21:45 published in: http://www.cnblogs.com/chenxizhang/
This article is copyrighted by the author and can be reproduced. However, this statement must be retained without the consent of the author. ArticleThe original text connection is clearly displayed on the page. Otherwise, the legal liability is retained.
For more blog articles, as well as the author's complete comments on Blog references and the policy of cooperation, please refer to the following site: Chen xizhang's blog Center
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.