I'm using:
Microsoft SQL Server 2008 (SP3)
I'm trying to pivot a view. Here's the code:
select Company_Code ,Vendor_Code ,[CC] AS CC ,[COI - AL] AS COI_AL ,[COI - AL C] AS COI_AL_C ,[COI - ER] AS COI_ER ,[COI - ER C] AS COI_ER_C ,[COI - EX] AS COI_EX ,[COI - EX C] AS COI_EX_C ,[COI - GL] AS COI_GL ,[COI - GL C] AS COI_GL_C ,[COI - PL] AS COI_PL ,[COI - PL C] AS COI_PL_C ,[COI - WC] AS COI_WC ,[COI - WC C] AS COI_WC_C ,[CONFID] AS CONFID ,[GENLIAB] AS GENLIAB ,[IC] AS IC ,[LR] AS LR ,[LW] AS LW ,[MSA AGR] AS MSA_AGR ,[MSA-EFF-DT] AS MSA_EFF_DT from dbo.VN_VEND_SUB_DOC_TRACK_MC pivot ( max(Expire_Date) for Tracking_Item_Code in ( [CC] ,[COI - AL] ,[COI - AL C] ,[COI - ER] ,[COI - ER C] ,[COI - EX] ,[COI - EX C] ,[COI - GL] ,[COI - GL C] ,[COI - PL] ,[COI - PL C] ,[COI - WC] ,[COI - WC C] ,[CONFID] ,[GENLIAB] ,[IC] ,[LR] ,[LW] ,[MSA AGR] ,[MSA-EFF-DT])) as ExpDate
The error I'm getting is:
Msg 102, Level 15, State 1, Line 27
Incorrect syntax near '('.
I've worn out Google trying to figure out what's wrong, but cannot find any solution.
TIA