SQL SERVER backup database stored procedures, backup data stored procedures

Source: Internet
Author: User

SQL SERVER backup database stored procedures, backup data stored procedures

SQL Server batch export Stored Procedure

In the query analyzer, right-click "database --" and choose "task". In the pop-up menu, select "generate script"

-- "" Next "--" select the database in which you want to store the stored procedure --"

"Next" -- select "Stored Procedure" and click "Next" --"

Select the name of the stored procedure you want to generate and click "Next".

Select save script to file, and select Save path --"

There is also a direct implementation through SQL statements:

Set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgo alter procedure [dbo]. [dbBak] as begin declare @ sqlCommand NVARCHAR (1000) DECLARE @ dateTime NVARCHAR (20) SELECT @ dateTime = REPLACE (CONVERT (VARCHAR, GETDATE (), 111 ),'/', '') + REPLACE (CONVERT (VARCHAR, GETDATE (), 108), ':','') SET @ sqlCommand = 'backup DATABASE BLNBusyData to disk = 'd: \ DataBaseBakUp \ bln _ '+ @ dateTime + '. BAK ''' EXECUTE sp_executesql @ sqlCommandEND

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.