The identifier that starts with ...... is too long. Maximum length is 128
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
.
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
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 AS
Alias1...
).
Use instead single quotes:
update hotel
set hotel_policy = 'Overview of Park Central ...'
where hotel_id = 1
Sql Query throws Identifier is too long. Maximum length is 128
Use single quotes and escape your quotes in the text with two single quotes:
update dbo.DataSettings set
set Query= '/Details?$filter=(Status ne ''yes'' and Status ne ''ok'')&$expand=name,Address/street,phone/mobile&$orderby=details/Id desc'
where id=5
is too long. Maximum length is 128. while using double quotes
I have found a solution for that: I have to execute the SP with SET QUOTED_IDENTIFIER OFF before exec SP, I had SET QUOTED_IDENTIFIER OFF - in my SP - but it has to be executed every time I execute SP. (SP is executed in the software.)
Example:
SET QUOTED_IDENTIFIER OFF
Exec [TestLog]
@PrimaryName = "test"
,@ERROR = "Violation of PRIMARY KEY constraint 'PK__AP__2EC21549E681BC94'. Cannot insert duplicate key in object 'dbo.Test'. The duplicate key value is (215009).
The statement has been terminated."
Then I will avoid a a 128 len probmem.
SQL Server : FOR XML PATH: the identifier that starts with ... is too long. maximum length is 128
There is no setting that you can change for this. The issue that you're running into is detailed here. Search that page for "identifier" and you'll see that the 128 length is hard-coded.
Related Topics
How to Delete Duplicate Records in Sql
Replacing Certain Character in Email Addresses with '*' in an SQL Query
Sql Server: Table Variable Used in a Inner Join
Retrieve The Most Recent Record for Each Customer
Sql String Manipulation [Get All Text Left of '(']
Db (Sql) Automated Stress/Load Tools
How to Insert Distinct Records from Table a to Table B (Both Tables Have Same Structure)
Insert Binary File into Mssql Db (Varbinary) with Python Pymssql
Fillfactor for a Sequential Index That Is Pk
Error: Subquery Must Return Only One Column
Comparing Comma Separated Values from Two Columns of Two Different Tables
Inserting Guid into SQL Server
Sqlite3 Database Is Locked in Azure
Importing and Validating Xml File Using Ssis or Just Plain T-Sql