The fourth session of SQL Server uses the database language while loop to do the summation. As well as database backup, restore, detach, attach. and CHECK constraints

Source: Internet
Author: User

drop proc qiuhecreate proc Qiuhe--accumulate sum @n in database languageint asDeclare @sumint--equivalent to defining variables in the C # language declare @iint  Set@sum =0--assigns a value to the variable, which is equivalent to the C # languageintsum=0  Set@i=1--equivalent to the In-loopintI=1(intI=1; i<=n;i++)   while@i<[email protected]-- for(intI=1; i<=n;i++) BeginSet@[email protected]+@iSet@[email protected]+1--equivalent to the i++ in the For loopEndreturn@sumgodeclare @aintexec @a=qiuheTenPrint @a--Check Constraint--constraints on a particular column, such as restricting the performance of the student's table degree>0and degree< -, if this range is exceeded, data cannot be added---Backup of databases ' restore--without affecting the normal operation of the database, the data is backed up to a. Back end file--Right-click the database button--Detach, attach--Detach: Separate the speaking database from the database service--Attach: Speak the database MDF file, attach to the database service

The fourth session of SQL Server uses the database language while loop to do the summation. As well as database backup, restore, detach, attach. and CHECK constraints

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.