Skip to Content
0

A workaround for the identifier too long error?

Feb 08 at 04:07 PM

49

avatar image

This code below gives me the identifier too long error and I have been researching a workaround for it. So far nothing good has turned up... Would anyone know how to handle this error?

select name, 
   [If yes, please specify one of the following languages (American Sign 
Language (ASL), Amharic, Chinese, French, Korean, Spanish or Vietnamese):]
from 
(
select name, question, response
from [dw_prod].[dbo].[Assessment$]
) as sourceTable
pivot
(
max (response)
for question
in (
[If yes, please specify one of the following languages (American Sign 
Language (ASL), Amharic, Chinese, French, Korean, Spanish or Vietnamese):]
)
)
as pivottable
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Clas Hortien Feb 08 at 04:47 PM
1

Hello,

you have specified the string

Ifyes, please specify one of the following languages (American SignLanguage(ASL), Amharic, Chinese, French, Korean, Spanish or Vietnamese):

as the column name for the second column. This string is too long (143 chars), the maximum length is 128 chars.

Best regards

Clas Hortien

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Yes, I know. Do you know how to truncate it with the PIVOT function?

0

This is not possible, you have to shorten it in the select list already. Soemthing like:

select name, 
   [Choose one: American Sign Language (ASL), Amharic, Chinese, French, Korean, Spanish or Vietnamese]
from 
(
select name, question, response
from [dw_prod].[dbo].[Assessment$]
) as sourceTable
pivot
(
max (response)
for question
in (
[Choose one: American Sign Language (ASL), Amharic, Chinese, French, Korean, Spanish or Vietnamese]
)
)
as pivottable
0