Transact-SQL 调试器 -“错误列表”窗口Transact-SQL Debugger - Error List Window

适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions) 适用于:Applies to: 是SQL ServerSQL Server(所有支持的版本)yesSQL ServerSQL Server (all supported versions)

SQL Server Management StudioSQL Server Management Studio“错误列表”用于显示由 数据库引擎Database Engine 查询编辑器中的 IntelliSense 代码生成的语法和语义错误。The SQL Server Management StudioSQL Server Management Studio Error List displays the syntax and semantic errors that are generated from the IntelliSense code in the 数据库引擎Database Engine Query Editor.

此功能适用于 SSMS 版本17.9.1 和更早版本。This feature works with SSMS version 17.9.1 and earlier.

“错误列表”的功能Features of the Error List

“错误列表” 提供下列功能:The Error List provides the following functionality:

  • 编辑脚本时, “错误列表” 可显示由 数据库引擎Database Engine 查询编辑器中的 IntelliSense 生成的错误和警告。As you edit scripts, the Error List displays the errors and warnings produced by IntelliSense in the 数据库引擎Database Engine Query Editor.

  • 可以通过双击任意错误消息项来着重查看生成此错误的脚本文件的选项卡,并移至出错的位置。You can double-click any error message entry to focus on the tab for the script file that generated the error, and move to the error location.

  • 可以筛选要显示哪些项以及为每一项显示哪些列的信息。You can filter which entries you want to display, and which columns of information you want appear for each entry.

  • 修复某错误后,相应错误项将从 “错误列表” 中删除。After you fix an error, the error entry is removed from the Error List.

  • 关闭某个 Transact-SQLTransact-SQL 脚本文件的选项卡后,与该文件相关的错误将从 “错误列表” 中删除。When you close the tab for a Transact-SQLTransact-SQL script file, the errors for that file are removed from the Error List.

使用“错误列表”Working with the Error List

若要显示 “错误列表” ,请执行下列操作之一:To display the Error List, do one of the following:

  • “视图” 菜单上单击 “错误列表”On the View menu, click Error List.

  • 使用键盘快捷键 CTRL+\和 CTRL+E。Enter the keyboard shortcut CTRL+\, CTRL+E.

打开 “错误列表” 后,可以通过执行以下操作自定义视图:After you open the Error List, you can customize your view by performing the following actions:

  • 若要对列表进行排序,请单击任一列标题。To sort the list, click any column header. 若要按其他列对列表进行进一步排序,请按住 Shift 键然后单击其他列标题。To sort again by an additional column, press and hold the SHIFT key, and then click another column header.

  • 若要选择显示的列和隐藏的列,请从快捷菜单中选择 “显示列”To select which columns are displayed and which are hidden, select Show Columns from the shortcut menu.

  • 若要更改列显示的顺序,请将任一列标题向左或向右拖动。To change the order in which columns are displayed, drag any column header to the left or right.

“错误列表” 中不包含指向有关特定错误的附加信息的链接。The Error List does not link to additional information about specific errors.

Management Studio 中的 Transact-SQL 错误Transact-SQL Errors in Management Studio

SQL Server Management StudioSQL Server Management Studio 在以下位置显示 Transact-SQLTransact-SQL 脚本的错误:displays errors for Transact-SQLTransact-SQL scripts in the following locations:

  • “错误列表” 包含 IntelliSense 在 数据库引擎Database Engine 编辑器中找到的所有语法和语义错误。The Error List contains all syntax and semantic errors found by IntelliSense in the 数据库引擎Database Engine Editor. 当您编辑 Transact-SQLTransact-SQL 脚本时,此错误列表将动态更新。This list of errors is dynamically updated as you edit Transact-SQLTransact-SQL scripts. 此列表包括编辑器在每个 Transact-SQLTransact-SQL 脚本中找到的所有错误。The list includes all errors that the editor has found in each Transact-SQLTransact-SQL script. 在脚本中遇到错误后,编辑器并不会停止分析文件。The editor does not stop parsing a file after encountering errors in a script. SQL Server 2008SQL Server 2008中, 数据库引擎Database Engine 编辑器中的 IntelliSense 不支持所有 Transact-SQLTransact-SQL 语法元素。In SQL Server 2008SQL Server 2008, IntelliSense in the 数据库引擎Database Engine Editor does not support all Transact-SQLTransact-SQL syntax elements. “错误列表” 仅包含 IntelliSense 支持的 Transact-SQLTransact-SQL 语法所产生的错误。The Error List contains only errors from the Transact-SQLTransact-SQL syntax that is supported by IntelliSense.

  • 查询编辑器底部的 “消息” 数据库引擎Database Engine 选项卡显示执行 SQL Server 数据库引擎SQL Server Database Engine 脚本时 Transact-SQLTransact-SQL 返回的所有错误和警告。The Messages tab at the bottom of the 数据库引擎Database Engine Query Editor window displays all errors and messages that are returned by the SQL Server 数据库引擎SQL Server Database Engine when a Transact-SQLTransact-SQL script is executed. 只有再次执行该脚本此列表才会发生变化。This list does not change until you execute the script again. 数据库引擎Database Engine 找到一个或两个编译错误后,它将停止分析批处理;因此, “消息” 选项卡中可能不会列出脚本中的所有错误。The 数据库引擎Database Engine stops parsing a batch after it finds one or two compile errors; therefore, the Messages tab might not list all errors in a script.

有时候错误会同时在上述两个位置列出。Sometimes errors are listed in both locations. 例如,某脚本文件可能存在已在 “错误列表” 中列出的语法错误。For example, a script file might have a syntax error that is listed in the Error List. 如果在纠正此错误之前执行了该脚本,则 数据库引擎Database Engine 分析器会检测到相同的错误情形并在 “消息” 选项卡中返回此错误消息。If you execute the script before you correct the error, the 数据库引擎Database Engine parser can detect the same condition and return another copy of the error message in the Messages tab.

备注

“错误列表”仅显示来源于 数据库引擎Database Engine 查询编辑器的错误,而不显示来源于 MDX、DMX 或 XML/A 编辑器的错误。The Error List only displays errors from the 数据库引擎Database Engine Query Editor; it does not display errors from the MDX, DMX, or XML/A Editors. 所有 MDX、DMX 和 XML/A 错误均显示在这些编辑器的“消息”选项卡中。All MDX, DMX, and XML/A errors are displayed in the Messages tab in those editors.

UI 元素列表UI element list

“错误列表” 后,将在以下列中显示相关信息:When the Error List is open, the information is displayed in the following columns:

默认顺序Default Order
显示一个整数,该整数指示相应项的生成次序。Displays an integer that indicates the order in which an entry was generated.

说明Description
显示相应错误项的文本。Displays the text of the error entry. 较长的说明会自动换行。Lengthy descriptions wrap onto additional lines.

FileFile
显示生成相应错误的脚本文件的名称。Displays the name of the script file that generated the error.

线条Line
显示一个整数,该整数指示包含相应错误的代码行。Displays an integer that indicates which line of the code includes the error.

Column
显示一个整数,该整数指示错误在相应代码行中的位置。Displays an integer that indicates the position of the error in the line of code.

项目Project
显示包含相应脚本文件的项目的名称。Displays the name of the project that includes the script file.