The identifier that starts with '' is too long. Maximum length is 128.- SQL Server Error

Scenario:

You are working as SQL Server developer or ETL Developer, One of your SSIS Package automatically generate the tables after reading the column name from your flat files and load the data. but you received below error when it was trying to create a table from a file.

Msg 103, Level 15, State 4, Line 39
The identifier that starts with '' is too long. Maximum length is 128.


Solution:

SQL Server allows only 128 characters for identifiers such as Stored Procedure name, Table Name, Column Name etc..
If we try to create an object with name of more than 128 characters, we get error.

--By using Replicate, generate 124 Character string
Select replicate('O',129)

--Create dbo.Customer table with Column of 128 Character length
Create table dbo.Customer
(OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO int)
go

--Create a Stored Procedure of name of 128 character length
Create Procedure  OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
as 
BEGIN
Select 2
END


Msg 103, Level 15, State 4, Line 42
The identifier that starts with 'OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 46
The identifier that starts with 'OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO' is too long. Maximum length is 128.


To solve this issue, simply we have to fix the length of our object names . If we are getting the files to load into sql server for which we have to create the tables dynamically by reading the column name, we need to make sure the column name length is no more than 128 characters.