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