DEV Community

Tim
Tim

Posted on

SQL Server: The Identifier Is Too Long; Max Length Is 128

In object creation, we'll either be explicitly creating objects (design/architecture) or allowing an automated process to do so. In both cases when we're using Microsoft SQL Server, we may face the following error, ERROR: The identifier that starts with '[value]' is too long. Maximum length is 128. The video discusses what this error means along with how we would proceed in fixing the error. Keep in mind that the solution may differ for explicitly versus automated creation.

Some questions that are answered in the video:

  • Early in the video, what are two platforms that are mentioned where we may see this error?
  • Where else may we see this error and why?
  • What would happen if we created a table with column names that all had more than 25 characters, but fewer than 75 in the context of this error and what would happen as far as the creation? What would happen to the table creation if we added a column with 135 characters?
  • In the context of anything that references or accesses SQL Server, what may be an underlying reason that we see this error?

Consider that if we had unlimited characters for identifiers, such as columns in this case, we would face other challenges such as referencing those columns in a report. Querying columns with long or counter-intuitive naming will not assist anyone responsible for building or maintaining reports.

On a point of architecture, we want to consider our naming in general - not just because we may be limited, but because we want to ensure that we can query and submit data easily. Consider best practices of naming that makes sense and fits the data context, avoids special character uses, abbreviates long words but not short words where there may be a conflict (ie: State vs St; shortening State to St does not help), and is memorable. By following these rules we would avoid this error in any design situation; note the context in the video of where we may experience this error.

Top comments (0)