• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 537
  • Last Modified:

SQL Error -- Identifier starts is too long.

Hi Experts

I have this dynamic sql when I try to exec it is erroring out.


The identifier starts with ''  is too long . Max length is 128.

Any thought here?

thannks!
SQL-Error----Identifier-starts-i.sql
0
parpaa
Asked:
parpaa
  • 5
  • 3
1 Solution
 
tlaytonCommented:
Post the dynamic SQL you are trying to EXEC please
0
 
parpaaAuthor Commented:
It is attached to the post.
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
please don't use '' inside the dynamic sql for column/alias names, but either " or [ ]

et @sql ='select       Physicians.PhysicianID ''PhysicianID'', Physicians.Name ''Physician Name''
should be
et @sql ='select       Physicians.PhysicianID "PhysicianID", Physicians.Name "Physician Name"
or
et @sql ='select       Physicians.PhysicianID [PhysicianID], Physicians.Name [Physician Name]
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
parpaaAuthor Commented:
Thanks @angelIII, I had replaced all alias name with [] but no luck :(
0
 
parpaaAuthor Commented:
We have alternative of doing this, if we declare one more variable @sql1 then split the dynamic query then join it.
something like this @sql=@sql1+@sql2
Problem is, I dont know how to do with this proc.
0
 
tlaytonCommented:
Try this just to check something please:
Expert-Comment.sql
0
 
tlaytonCommented:
I think your problem is the concatenating of nvarchar(max) strings with non-nvarchar(max) string, you should also put the dbname in as a nvarchar(max) and each concatenation needs to be CAST as nvarchar(max) to get the full benefit...
0
 
parpaaAuthor Commented:
@Tlayton.. No luck
0
 
parpaaAuthor Commented:
Thank you
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now