Estoy creando un query que toma un vista previamente creada donde aplico un pivot dinamico para convertir mis filas en columnas (creo un pivot dinamico ya que despues se agregaran mas filas) el problema es que al ejecutarlo me envia un error que muestro mas abajo en la publicacion
En la imagen muestro la tabla o la consulta que solo muestra esos 3 columnas feature es la que estoy tratando de convertir de filas a a a columnas
Al revisar o buscar una solicion encontré que se podía solucionar asinando alas variable el valor max
Como visualizan en el query ya cambie el valor de las variables a max y aun asi me sigue mostrando este error.
`declare @query varchar(MAX)
declare @Columns varchar(MAX)
--Optenemos la columnas pivot
select
@Columns=STUFF((select Distinct'],['+ Feature FROM FNA_vw_WitersTestCase
order by '],['+ Feature for XML PATH('') ),1,1,'')+']'
set @query ='select *
from (
select Feature,TC,DATyENAME(week,Date) as Weeks,DATENAME(year,Date) as Years FROM FNA_vw_WitersTestCase
)Cs
pivot (
max(TC) FOR[Feature] IN ('+@Columns+')
)Pv
'
execute (@query)`
--El error que me muestra es el siguiente;
Msg 102, Level 15, State 1, Line 27
Incorrect syntax near ','.
Msg 103, Level 15, State 4, Line 27
The identifier that starts with 'ALERT-FRD-REQ-212687/C-Alerts - Chimes/Prompts/Beeps/Audio Attenuation [CTR],[Alerts-Chimes-Prompts-Attenuation [SyncG3],[AM- FM' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 27
The identifier that starts with 'Bezel Diagnostics [CTR],[Bezel Diagnostics [SyncG3],[Bezel Diagnostics [SyncG4],[Boundary Alert [SyncG3],[BT Phone [SyncG3],[BTP' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 27
The identifier that starts with 'Climate Control [SYNC4],[CLK-FRD-REQ-017552/A-APIM Clock Strategy [CTR],[Connectivity Customer Opt-In Client [Sync G3],[Consider' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 27
The identifier that starts with 'Digital A2B Audio Bus [SyncG3],[Digital Owners Manual [SyncG4],[Digital RVC [SyncG3],[Digital RVC [SyncG4],[Display Mode (Day N' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 27
The identifier that starts with 'Frunk Softswitch [SyncG4],[GAL-FRD-REQ-213592/C-GAL [CTR],[Global Clock [SyncG3],[Google Automotive Link [SyncG3],[HUD Feature C' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 27
The identifier that starts with 'In-Vehicle Software Update (IVSU) [SyncG3],[LBP-FRD-REQ-213638/B-List Browser Protocol [CTR],[Lincoln Backup Ignition [SyncG4],[' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 27
The identifier that starts with 'Rear Camera On Demand [SyncG3],[Rear Seat Entertainment [SyncG3],[Rear Seat Entertainment [SyncG4],[Rear View Camera [SyncG3],[R' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 27
The identifier that starts with 'SIMA V2 - Steering Wheel Horizon Controller [Phoenix],[Sirius Satellite Radio v2 [SyncG3],[Station Management [SyncG 4.1],[Stati' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 27
The identifier that starts with 'Trailer Backup Assist v2 [SyncG3],[Trailer Backup Assist v2 [SyncG4],[Trailer Perimeter Alarm [SyncG4],[Trailer Reverse Guidance' is too long. Maximum length is 128.
Msg 103, Level 15, State 4, Line 27
The identifier that starts with 'Vehicle Settings [SyncG 4.1],[Vehicle Settings [SyncG3],[Video On Demand [SyncG3],[Visual Park Assist [SyncG3],[VOL-FRD-REQ-2127' is too long. Maximum length is 128.
Msg 105, Level 15, State 1, Line 27
Unclosed quotation mark after the character string 'Vehicle Settings [SyncG 4.1],[Vehicle Settings [SyncG3],[Video On Demand [SyncG3],[Visual Park Assist [SyncG3],[VOL-FRD-REQ-21270'.