SQL Server batch processing knowledge point

Source: Internet
Author: User
Batch processing is a set of T-SQL statements in a logical unit. To divide a script into multiple batches, you can use the GO statement. 1. The GO statement must have a row. 2. The GO statement allows each batch to be sent separately to the server and has nothing to do with other batch processors. (The Execution Plan is probably concurrent, so in many cases, you may need to take an exam

Batch processing is a set of T-SQL statements in a logical unit. To divide a script into multiple batches, you can use the GO statement. 1. The GO statement must have a row. 2. The GO statement allows each batch to be sent separately to the server and has nothing to do with other batch processors. (The Execution Plan is probably concurrent, so in many cases, you may need to take an exam

Batch processing is a set of T-SQL statements in a logical unit.

To divide a script into multiple batches, you can use the GO statement.

1. The GO statement must have a row.

2. The GO statement allows each batch to be sent separately to the server and has nothing to do with other batch processors. (The execution scheme is likely to be concurrent, so in many cases, order issues may need to be considered)

3. The GO statement is not a T-SQL command, but a recognition command formed by various SQLServer commands.

Batch Processing errors:

1. syntax errors are detected before execution.

2. runtime errors can only be detected after running (or). They generally violate integrity errors.

You must have your own batch statement:

1. Create Default

2. Create Procedure

3. Create Rule

4. Create Trigger

5. Create View

Note: If you want to combine these statements in a separate script, you need to use the GO statements to distribute them to their respective batches.

EXEC trap:

1. exec and the code that calls it run in a separate scope -- that is, the call code cannot reference the variable in the EXEC statement, after the variables in the call code are parsed as strings for the EXEC statement, EXEC cannot reference these variables. If you want to pass a value between dynamic SQL and the routine that calls it, use SQL-executeSQL.

2. By default, EXEC runs in the security context of the current user-not the security context of the called object. (Objects often run in the context of the object owner, rather than the current user)

3. EXEC and the calling object run in the same connection and transaction environment.

4. Execute the EXEC string. The concatenation of the function call must be prior to the EXEC statement actually called-the function cannot be executed in the same statement that executes the EXEC call.

5. EXEC cannot be used in user-defined functions.

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.