I am having one of those days.
I am trying to pivot the data below into columns
ID | SplitString
-------------------
| 1 | ABC
| 2 | ABC03082017
| 3 | 03082017
| 4 | 1
| 5 | TestData
So far I have the code below but when I run it, it is returning nulls, the columns have the correct header but the data is all null.
select *
from
(
select ID,splitData from dbo.fn_splitstring(@RawData_Header, '|')
) src
pivot
(
MAX(ID) for splitData in ([Identifier], [ProviderCode], [FileDate],[Code],[FileName])
) piv;
The first part of the pivot script is working correctly and returning the table above.
EDIT**
I am trying to return the data similar to the image below
Thanks for your help
Noelle

NULLbecause there are no rows with values[Identifier], [ProviderCode], [FileDate],[Code],[FileName]in columnsplitData. What are you trying to achive?SELECTyou are naming your columns. Documentation.