Home Database Mysql Tutorial SQLServer中批处理的知识点

SQLServer中批处理的知识点

Jun 07, 2016 pm 04:21 PM
sqlserver Batch processing Knowledge points

批处理是一个逻辑单元的一组T-sql语句。 为了将一个脚本分为多个批处理,可以使用GO语句。 1. GO语句必须自成一行。 2. GO语句使得每个批处理是单独发送到服务器的,与其他的批处理器无关。(这里面的执行方案很可能是并发的,所以在很多的情况下,可能需要考

   批处理是一个逻辑单元的一组T-sql语句。

  为了将一个脚本分为多个批处理,可以使用GO语句。

  1. GO语句必须自成一行。

  2. GO语句使得每个批处理是单独发送到服务器的,与其他的批处理器无关。(这里面的执行方案很可能是并发的,所以在很多的情况下,可能需要考虑顺序问题)

  3. GO语句不是T-sql命令,,而是由各种SQLServer命令适用成型的识别命令。

  批处理中的错误:

  1. 语法错误,在执行之前就会被检测。

  2. 运行时错误,只能在运行之后(或者之中)被检测到,一般是违反了完整性等错误。

  要求有自己批处理的语句:

  1. Create Default

  2. Create Procedure

  3. Create Rule

  4. Create Trigger

  5. Create View

  注:如果想在单独的脚本中将这些语句组合,则需要通过使用GO语句来将它们分散到各自的批处理中。

  EXEC的陷阱:

  1. Exec和调用它的代码都在单独的作用域下运行——也就是说,调用代码不能引用EXEC语句中的变量,并且在调用代码中的变量被解析为用于EXEC语句的字符串之后,EXEC不能引用这些变量。如果需要在动态SQL和调用它的例程间传递值,考虑使用SQL-executeSQL。

  2. 默认情况下,EXEC在当前用户的安全上下文下运行——而不是调用对象的安全上下文。(对象经常在对象所有者的上下文运行,而不是当前用户)

  3. EXEC与调用对象运行在相同的连接和事务环境下。

  4. 对EXEC字符串执行的要求函数调用的串联必须先于实际调用的EXEC的语句——不能在执行EXEC调用的相同语句中执行函数串联。

  5. EXEC不能再用户自定义函数内使用。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1670
14
PHP Tutorial
1274
29
C# Tutorial
1256
24
How to import mdf file into sqlserver How to import mdf file into sqlserver Apr 08, 2024 am 11:41 AM

The import steps are as follows: Copy the MDF file to SQL Server's data directory (usually C:\Program Files\Microsoft SQL Server\MSSQL\DATA). In SQL Server Management Studio (SSMS), open the database and select Attach. Click the Add button and select the MDF file. Confirm the database name and click the OK button.

How to solve the problem that the object named already exists in the sqlserver database How to solve the problem that the object named already exists in the sqlserver database Apr 05, 2024 pm 09:42 PM

For objects with the same name that already exist in the SQL Server database, the following steps need to be taken: Confirm the object type (table, view, stored procedure). IF NOT EXISTS can be used to skip creation if the object is empty. If the object has data, use a different name or modify the structure. Use DROP to delete existing objects (use caution, backup recommended). Check for schema changes to make sure there are no references to deleted or renamed objects.

Python cheat sheet collection, what knowledge points have you mastered? Python cheat sheet collection, what knowledge points have you mastered? Apr 26, 2023 pm 10:49 PM

Python is currently the most popular programming language. I believe that a large number of novice friends will join the ranks of learning every day. However, no matter how easy a language is to learn, there are still many basic concepts and basic knowledge. For a novice, it is still difficult to master so many in one time. Today, we have collected many Python-related knowledge cheat sheets, which can be said to be all-inclusive. In the future, mom will no longer have to worry about everyone not being able to remember any knowledge points! Python basics Pythonbasics This cheat sheet contains all the basic knowledge of Python, from variable data types to list strings, from environment installation to the use of commonly used libraries, it can be said to be comprehensive. Beginner'sPytho

How to check sqlserver port number How to check sqlserver port number Apr 05, 2024 pm 09:57 PM

To view the SQL Server port number: Open SSMS and connect to the server. Find the server name in Object Explorer, right-click it and select Properties. In the Connection tab, view the TCP Port field.

How to recover accidentally deleted database in sqlserver How to recover accidentally deleted database in sqlserver Apr 05, 2024 pm 10:39 PM

If you accidentally delete a SQL Server database, you can take the following steps to recover: stop database activity; back up log files; check database logs; recovery options: restore from backup; restore from transaction log; use DBCC CHECKDB; use third-party tools. Please back up your database regularly and enable transaction logging to prevent data loss.

How to close all Google Chrome windows and tabs at once How to close all Google Chrome windows and tabs at once Apr 14, 2023 pm 05:28 PM

So, you work hard. Of course, the rough-and-tumble worker has 1,000 Chrome windows and tabs open all the time. You absolutely don't have the patience to open every Chrome window and close them one by one. You will think at least 100 times about how to easily close all open Chrome windows and tabs with just one click! Well, why should you worry while we're here? In this article, we explain how to close all open Chrome windows easily through 2 different methods, a non-geek method and a geek method! Hope you like it! Method 1: Through any open Google Chrome window This method is very simple and involves only one step. So you open a lot of Google

Where is the sqlserver database? Where is the sqlserver database? Apr 05, 2024 pm 08:21 PM

SQL Server database files are usually stored in the following default location: Windows: C:\Program Files\Microsoft SQL Server\MSSQL\DATALinux: /var/opt/mssql/data The database file location can be customized by modifying the database file path setting.

What to do if the sqlserver service cannot be started What to do if the sqlserver service cannot be started Apr 05, 2024 pm 10:00 PM

When the SQL Server service fails to start, here are some steps to resolve: Check the error log to determine the root cause. Make sure the service account has permission to start the service. Check whether dependency services are running. Disable antivirus software. Repair SQL Server installation. If the repair does not work, reinstall SQL Server.

See all articles