<i id='HEOa8'><tr id='HEOa8'><dt id='HEOa8'><q id='HEOa8'><span id='HEOa8'><b id='HEOa8'><form id='HEOa8'><ins id='HEOa8'></ins><ul id='HEOa8'></ul><sub id='HEOa8'></sub></form><legend id='HEOa8'></legend><bdo id='HEOa8'><pre id='HEOa8'><center id='HEOa8'></center></pre></bdo></b><th id='HEOa8'></th></span></q></dt></tr></i><div id='HEOa8'><tfoot id='HEOa8'></tfoot><dl id='HEOa8'><fieldset id='HEOa8'></fieldset></dl></div>
      • <bdo id='HEOa8'></bdo><ul id='HEOa8'></ul>
    1. <legend id='HEOa8'><style id='HEOa8'><dir id='HEOa8'><q id='HEOa8'></q></dir></style></legend>

      <tfoot id='HEOa8'></tfoot>

      <small id='HEOa8'></small><noframes id='HEOa8'>

      SQL Server - 参数名称中的无效字符

      SQL Server - Invalid characters in parameter names(SQL Server - 参数名称中的无效字符)
        1. <small id='7hU2F'></small><noframes id='7hU2F'>

          <tfoot id='7hU2F'></tfoot>

        2. <i id='7hU2F'><tr id='7hU2F'><dt id='7hU2F'><q id='7hU2F'><span id='7hU2F'><b id='7hU2F'><form id='7hU2F'><ins id='7hU2F'></ins><ul id='7hU2F'></ul><sub id='7hU2F'></sub></form><legend id='7hU2F'></legend><bdo id='7hU2F'><pre id='7hU2F'><center id='7hU2F'></center></pre></bdo></b><th id='7hU2F'></th></span></q></dt></tr></i><div id='7hU2F'><tfoot id='7hU2F'></tfoot><dl id='7hU2F'><fieldset id='7hU2F'></fieldset></dl></div>

                <bdo id='7hU2F'></bdo><ul id='7hU2F'></ul>
                <legend id='7hU2F'><style id='7hU2F'><dir id='7hU2F'><q id='7hU2F'></q></dir></style></legend>
                  <tbody id='7hU2F'></tbody>
                本文介绍了SQL Server - 参数名称中的无效字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我需要知道在 SQL 参数名称中使用哪些有效字符.

                I need to know what are the valid characters to use in a SQL parameter name.

                给定类似 SELECT * FROM tblTest WHERE testid = @[X] 的简单代码,例如,如果 X 包含连字符,则语句将失败.参数名称的有效字符是什么?

                Given something simple like SELECT * FROM tblTest WHERE testid = @[X], if X contains a hyphen, for instance, the statement will fail. What are the valid characters for parameter names?

                推荐答案

                在您的 SQL 在线书籍中搜索标识符",您应该找到:

                Search for "Identifiers" in your SQL Books online, and you should find:

                常规标识符规则

                常规标识符的格式规则取决于数据库兼容级别.可以使用 sp_dbcmptlevel 设置此级别.当兼容级别为 90 时,以下规则适用:

                The rules for the format of regular identifiers depend on the database compatibility level. This level can be set by using sp_dbcmptlevel. When the compatibility level is 90, the following rules apply:

                第一个字符必须是以下之一:

                The first character must be one of the following:

                • Unicode 标准 3.2 定义的字母.字母的 Unicode 定义包括从 a 到 z 的拉丁字符,
                  从 A 到 Z,以及来自其他语言的字母字符.
                • 下划线 (_)、at 符号 (@) 或数字符号 (#).

                标识符开头的某些符号具有特殊性SQL Server 中的意思.以 at 开头的常规标识符符号始终表示局部变量或参数,不能使用作为任何其他类型对象的名称.开头的标识符带数字符号表示临时表或过程.一个以双数字符号 (##) 开头的标识符表示全局临时对象.虽然数字符号或双数字符号字符可用于开始其他类型的对象的名称,我们不推荐这种做法.

                Certain symbols at the beginning of an identifier have special meaning in SQL Server. A regular identifier that starts with the at sign always denotes a local variable or parameter and cannot be used as the name of any other type of object. An identifier that starts with a number sign denotes a temporary table or procedure. An identifier that starts with double number signs (##) denotes a global temporary object. Although the number sign or double number sign characters can be used to begin the names of other types of objects, we do not recommend this practice.

                某些 Transact-SQL 函数的名称以双符号开头(@@).为避免与这些功能混淆,您不应使用以@@ 开头的名称.

                Some Transact-SQL functions have names that start with double at signs (@@). To avoid confusion with these functions, you should not use names that start with @@.

                后续字符可以包括以下内容:

                Subsequent characters can include the following:

                • Unicode 标准 3.2 中定义的字母.
                • 来自基本拉丁文或其他国家文字的十进制数字.
                • at 符号、美元符号 ($)、数字符号或下划线.

                标识符不能是 Transact-SQL 保留字.数据库服务器保留保留字的大写和小写版本.不允许嵌入空格或特殊字符.补充不允许使用字符.

                The identifier must not be a Transact-SQL reserved word. SQL Server reserves both the uppercase and lowercase versions of reserved words. Embedded spaces or special characters are not allowed. Supplementary characters are not allowed.

                在您的在线 SQL 书籍中搜索分隔标识符",您应该找到:

                Search for "delimited identifiers" in your SQL Books online, and you should find:

                标识符的主体可以包含中字符的任意组合当前代码页,除了分隔字符本身.为了例如,分隔标识符可以包含空格,任何有效字符对于常规标识符,以及任何一个以下字符.

                The body of the identifier can contain any combination of characters in the current code page, except the delimiting characters themselves. For example, delimited identifiers can contain spaces, any characters valid for regular identifiers, and any one of the following characters.

                tilde (~)                hyphen (-)   
                exclamation point (!)    left brace ({)   
                percent (%)              right brace (})   
                caret (^)                apostrophe (')   
                ampersand (&)            period (.)   
                left parenthesis (()     backslash ()   
                right parenthesis ())    accent grave (`)
                

                马克

                这篇关于SQL Server - 参数名称中的无效字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                SQL query to group by day(按天分组的 SQL 查询)
                What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)
                MySQL groupwise MAX() returns unexpected results(MySQL groupwise MAX() 返回意外结果)
                MySQL SELECT most frequent by group(MySQL SELECT 按组最频繁)
                Include missing months in Group By query(在 Group By 查询中包含缺失的月份)
                Why Mysql#39;s Group By and Oracle#39;s Group by behaviours are different(为什么 Mysql 的 Group By 和 Oracle 的 Group by 行为不同)

                  <tfoot id='hX1El'></tfoot>
                    <tbody id='hX1El'></tbody>

                  <small id='hX1El'></small><noframes id='hX1El'>

                • <legend id='hX1El'><style id='hX1El'><dir id='hX1El'><q id='hX1El'></q></dir></style></legend>
                    <bdo id='hX1El'></bdo><ul id='hX1El'></ul>

                      1. <i id='hX1El'><tr id='hX1El'><dt id='hX1El'><q id='hX1El'><span id='hX1El'><b id='hX1El'><form id='hX1El'><ins id='hX1El'></ins><ul id='hX1El'></ul><sub id='hX1El'></sub></form><legend id='hX1El'></legend><bdo id='hX1El'><pre id='hX1El'><center id='hX1El'></center></pre></bdo></b><th id='hX1El'></th></span></q></dt></tr></i><div id='hX1El'><tfoot id='hX1El'></tfoot><dl id='hX1El'><fieldset id='hX1El'></fieldset></dl></div>