Azure SQL Business

Source: Internet
Author: User
Tags getdate management studio sql server management sql server management studio sql server management studio 2014

Because of the need to periodically remove the longer-term information, which is not directly created by Azure SQL db at the moment, one way to do this is to execute Azure SQL instructions through local SQL server.

The steps are as follows:

SQL Server Management Studio 2014, after logging on local, open SQL Server Agent

New industry, enter the name:

Added step, the input name is "create list":

Type select "Operating System (CMDEXEC)", perform identity "sql Server Agent service Mega",

The command is:

sqlcmd-u"Mega"-d"Information repository name"-s"xxxxxxx.database.windows.ne"t-p"login"-i C:\script\deleteLog.sql-o c:\script\azureoutput. Tx

C:\script\deleteLog.sql This script is required to perform SQL language, such as delete table and so on;

    • -U Azure SQL logging Mega user
    • -D Information Repository name
    • -P Azure SQL login password
    • -I execute the script path
    • -O Execute Results output file

Setup Output files:

Add the following schedule:

The type is "repetitive".

Born "Daily"

Repeat frequency "1" days

The Activity Viewer can view all the operating status of the industry, and if it is wrong, you can view the file specified in the previous step-O.

Deletelog.sql is as follows:

DELETE from Tkblsts where Job_no in (SELECT job_no from TKBL where (group_id<> ' EG ' and group_id<> ' PL ') and CRE Ate_date < DATEADD (Month,-4,getdate ())); Godelete from Tkblpty where Job_no in (SELECT job_no from TKBL where (group_id<> ' EG ' and group_id<> ' PL ') and C Reate_date < DATEADD (Month,-4,getdate ())); Godelete from Tkblcntr where Job_no in (SELECT job_no from TKBL where (group_id<> ' EG ' and group_id<> ' PL ') and Create_date < DATEADD (Month,-4,getdate ())); Godelete from Tkblflno where Job_no in (SELECT job_no from TKBL where (group_id<> ' EG ' and group_id<> ' PL ') and Create_date < DATEADD (Month,-4,getdate ())); Godelete from Tkblpo where Job_no in (SELECT job_no from TKBL where (group_id<> ' EG ' and group_id<> ' PL ') and CR Eate_date < DATEADD (Month,-4,getdate ())); Godelete from TKBL WHERE (group_id<> ' EG ' and group_id<> ' PL ') and Create_date < DATEADD (Month,-4,getdate () ); Godelete from Oth_log1 WHERE create_date < DATEADD (Day,-10,getdate ());

  

Azure SQL Business

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.