SQL Server Error 1055: Invalid Name Fix
In this article
SQL Server error 1055 (“The identifier that starts with … is too long. Maximum length is 128.”) is not actually about a name containing illegal characters—it is a length error. The fix is to shorten the identifier to 128 characters or fewer, or to alias it in your query. If you are seeing a message about an “invalid name because it contains,” the object name likely exceeds the 128-character limit for regular identifiers. You do not need to restart the server or reinstall anything; you need to edit the offending name in your T-SQL, SSMS object explorer, or application code.
What You'll Need
- Access to SQL Server Management Studio (SSMS) or Azure Data Studio, connected with an account that can view and alter the object.
- The exact error text, including the truncated identifier SQL Server shows in the message.
- Permission to run
ALTERstatements on the affected table, column, index, or other object. - A backup or script of the object definition before renaming anything in production.
Step-by-Step
- Read the full error message. SQL Server prints the first part of the offending identifier and states the maximum length (128 characters for most identifiers). Copy that text into a scratch file so you can match it to the object.
- Locate the object. In SSMS, use Object Explorer to expand the database and the relevant folder (Tables, Columns, Indexes, etc.). If the name is too long to read easily, run a query against
sys.objectsorsys.columnsfiltering onLEN(name) > 128to list every over-length name in the database. - Confirm the character count. Use
SELECT LEN('your_identifier')or count characters in a text editor. Regular identifiers are limited to 128 characters; local temporary tables are limited to 116 characters including the#prefix. If the count exceeds the limit, that is the cause. - Shorten the name. For a table or column, run an
ALTER TABLE … RENAMEequivalent for your object type—for examplesp_rename 'dbo.old_long_name', 'short_name'for a table or column. For indexes and constraints, usesp_renamewith the correct object type. Keep the new name under 128 characters and avoid leading digits, spaces, or reserved words unless you delimit with brackets. - Update every reference. Search your stored procedures, views, functions, triggers, and application connection strings for the old name. Renaming the object does not automatically rewrite hard-coded references in application code, so update those separately.
- Re-run the failing statement. Execute the original query or application action. If the error persists, check for a second over-length identifier in the same statement—SQL Server stops at the first one it encounters.
- If you cannot rename the object, alias it. In a
SELECTlist, give the long column a short alias:SELECT very_long_column_name AS short_name FROM …. This resolves the error for that query without changing the schema, but it does not fix the underlying object name for other queries.
Common Mistakes
- Assuming the error is about special characters. Error 1055 is a length error. Brackets, spaces, and symbols are handled by delimited identifiers; the 128-character cap applies to regular identifiers regardless of characters used.
- Renaming only the table. Columns, indexes, and constraints can each exceed the limit. Check every object in the statement, not just the table name.
- Forgetting application code. Renaming in SQL Server does not update ORM mappings, stored procedure calls, or connection strings. Search the codebase for the old name before deploying.
- Using
sp_renamewithout the schema. Include the schema (for exampledbo.) in the old name, or the rename may fail or target the wrong object. - Ignoring temporary table limits. Local temp tables are capped at 116 characters including the
#prefix, so a name that is valid for a permanent table can still fail for a temp table.
Tips
- Keep identifiers short and descriptive from the start—under 64 characters is a practical habit that leaves room for suffixes like
_historyor_archive. - Use a naming convention that includes the schema and object type, which makes over-length names obvious before they reach production.
- Script the object before renaming so you can roll back quickly if a dependent view or procedure breaks.
- When generating names programmatically (for example from user input or timestamps), truncate to a safe length and add a short hash if uniqueness matters.
- Run a periodic check for over-length names with a query against
sys.objectsandsys.columnsto catch problems before they surface in application errors.
Troubleshooting
If shortening the name does not clear the error, work through these checks in order. First, confirm you edited the object the error actually names—SQL Server may report a column while you renamed the table. Second, check for a second over-length identifier in the same batch; the error stops at the first one. Third, verify that your client tool or ORM is not appending a suffix (such as a schema prefix or a generated alias) that pushes the name over the limit. Fourth, if the error appears only from one application, compare the query text it sends with the query you tested in SSMS—parameterization or dynamic SQL can change the identifier length. Fifth, if you cannot rename because of dependencies, use column aliases in the affected queries as a stopgap, then schedule the rename with a maintenance window. If the object is a system-generated name (for example an automatically named constraint), drop and recreate it with an explicit short name. Always test renames on a copy of the database first; renaming a column can break views, stored procedures, and application code that reference the old name.
Frequently Asked Questions
What exactly causes SQL Server error 1055?
An identifier in your statement exceeds the maximum length SQL Server allows. For most objects that limit is 128 characters; local temporary tables are limited to 116 characters including the # prefix.
Does error 1055 mean my name has invalid characters?
No. The message mentions length, not character validity. Characters like spaces or symbols are handled by enclosing the name in brackets; the 128-character cap applies either way.
Can I fix it without renaming the object?
Yes, for a single query. Add a short alias to the over-length column in the SELECT list. This resolves that statement but does not change the schema for other queries or applications.
Will renaming a column break my application?
It can. Renaming in SQL Server does not update hard-coded references in application code, ORM mappings, or stored procedures. Search for the old name and update every reference before deploying.
How do I find every over-length name in a database?
Query the system catalog views, for example SELECT name FROM sys.objects WHERE LEN(name) > 128 and the equivalent on sys.columns. That lists objects and columns that exceed the limit.
Does the 128-character limit apply to all object types?
Most identifiers—tables, columns, indexes, constraints, and stored procedures—share the 128-character limit. Local temporary tables are the notable exception at 116 characters including the # prefix.