1 annotator
Annotation is a text string that is not executed in the program code. It is a description of the program, which can improve the readability of the program and make the program code easier to maintain, it is usually embedded in a program and displayed with special marks. In Transact-SQL, annotations can be included in batch processing, stored procedures, and triggers. There are two types of annotators:
--: This is an ANSI-standard annotator consisting of two consecutive characters for single line comments.
/*... */: This is the same program annotator as the C language./* is used to start the comment text. */is used to end the comment text. multiple lines of text can be identified as the comment statement in the program.
2. PRINT)
The PRINT statement of the output statement is used to transmit a message to a client application. It is usually displayed on the user screen. The message string can contain up to 8000 characters, and any character exceeding 8000 characters is truncated. The PRINT statement can only transmit text strings or a single character variable. The PRINT statement can also pass global variables, but can only be a global variable of the character type.
PRINT statement Syntax:
PRINT 'text' | @ local variable | @ global variable | string expression
Although the PRINT statement can only display strings, many functions are provided in Transact-SQL to convert other data types into strings.
3. RAISERROR)
The RAISERROR command is used to return user-specified information when the SQL Server 2005 system returns an error message. The RAISERROR command can automatically record the error number specified in the global variable @ error, and send the text of the error number, severity, error status, and error message to the customer's application.
Compared with PRINT, RAISERROR is more powerful in returning messages to applications. Therefore, if you need to call SQL Server 2005 database system errors in a program, you need to use the RAISERROR command.
4. SET)
In SQL Server 2005, some options are set in the database system to affect the way the Server processes specific conditions. These options exist in the user's connection to the Server or the user's stored procedures and triggers, you can use the SET statement to SET these parameters. Syntax:
SET condition {on | off | Value}