以......开头的标识符太长.最大长度为 128 [英] The identifier that starts with ...... is too long. Maximum length is 128

查看:91
本文介绍了以......开头的标识符太长.最大长度为 128的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将我的数据库转移到 MS SQL Server 2008 R2,当我试图保存长字符串时,它给了我最大长度的错误,而我已经将该列的数据类型设置为文本"之后我用varchar(max)"替换了它,但没有解决方案.

I am shifting my database to MS SQL Server 2008 R2, When I am trying to save long length string then it is giving me the error for Maximum length, while i have set the datatype of that column as "text" after it i replaced it with "varchar(max)" but no solution there.

请为我提供如何解决此问题的解决方案.我正在执行以下查询:

kindly provide me a solution how to resolve this issue. I am executing the following query:

update hotel 
set hotel_policy = 
    "Overview of Park Central New York - New York
    This hotel is making improvements.
        The property is undergoing renovations. The following areas are affected:
        Bar/lounge
        Business center
        Select guestrooms

    Every effort will be made to minimize noise and disturbance.
    Occupying a Beaux Arts building dating to 1927, Park Central New York Hotel is within a block of famed concert venue Carnegie Hall and within a 5-minute walk of Manhattan’s world-renowned Broadway theater district. Prefer the great outdoors to the Great White Way? Central Park is just 3 blocks from the hotel. There, you can rent a rowboat at the lake, play a game of tennis, or visit the Central Park Zoo. The international boutiques and flagship department stores of Fifth Avenue start within a 10-minute walk of the hotel. For travel to sights farther afield, there are 7 subway lines located within 3 blocks of the Park Central.
    The hotel has a snack bar for guests' convenience, and coffee and tea in the lobby.
    Retreat to your guestroom and sink into a bed with a pillowtop mattress and down comforter and pillows. Need to check email or finish up some work? You’ll find a desk with an ergonomic chair and wireless high-speed Internet access (surcharge). Unwind with a video game (surcharge) on the flat-panel HDTV."

where hotel_id = 1

我搜索了很多,但我找到的解决方案对我没有用.

I search it a lot but the solutions i found are not useful to me.

谢谢!

推荐答案

根据 ANSI SQL 标准,对象标识符使用双引号(如果必要)(例如 UPDATE "hotel" ...) 而不是字符串分隔符 ("Overview of Park Central ...").当 QUOTED_IDENTIFIERON 时,SQL Server 具有此行为.

According to ANSI SQL standard, double quotes are used (if necessary) for object identifiers (ex. UPDATE "hotel" ...) and not as string delimiters ("Overview of Park Central ..."). SQL Server has this behavior when QUOTED_IDENTIFIER is ON.

编辑 1:单双引号作为对象标识符(包括列别名)的分隔符的用法描述如下:

Edit 1: The usage of single and double quotation marks as delimiters for object identifiers (including column aliases) is described below:

                        Delimiter   Delimiter
                        for         for
SET QUOTED_IDENTIFIER   Object ID   Alias ID        StringDelimiter
ON                      " or []     " or ' or []    '
OFF                     []          " or ' or []    " or '

  • ON 那么双引号可以用作对象标识符(包括列别名)的分隔符,单引号用作字符串文字和/或列别名的分隔符(SELECT Column1 AS'Alias1' ....) 标识符.
  • OFF 那么双引号可以用作列别名的分隔符 (SELECT Column1 AS "Alias1" ...) 和字符串文字的分隔符 (SELECT "String1" AS Alias1 ...).单引号可用作字符串分隔符和列别名的分隔符 (SELECT Column1 ASAlias1...).
    • ON then double quotes can be used as delimiter for object identifiers (including column aliases) and single quotes are used as delimiters for string literals and/or for column aliases (SELECT Column1 AS 'Alias1' ....)identifiers.
    • OFF then double quotes can be used as delimiter for columns aliases (SELECT Column1 AS "Alias1" ...) and as delimiter for string literals (SELECT "String1" AS Alias1 ...). Single quotation marks can be used as string delimiter and as delimiter for column aliases (SELECT Column1 ASAlias1...).
    • 改用单引号:

      update hotel 
      set hotel_policy = 'Overview of Park Central ...'
      where hotel_id = 1
      

      这篇关于以......开头的标识符太长.最大长度为 128的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆