Hi Joel,
I understand that you were using Pivot Transformation component in SSIS to
transfer data, however you encountered the error regarding invalid pivot
key.
If I have misunderstood, please let me know.
I recommend that you check if you set SourceColumn to the LineageID of
PLAN_SEQUENCE. If so, please correct it to the LineageID of PLAN_SCHOOL
since the pivoted values are actually from PLAN_SCHOOL, while ID_LOGIN and
PLAN_SEQUENCE are pivoted rows and columns.
Generally for a pivoted table, the layout is as following:
============================
Quote:
columns
---------|-------------------------
|
rows | data
Quote:
|
============================
|
So if the sourcecolumn (data area) was specified to match other column
(rows area), it is invalid.
Also based on your description, I performed the following test and it
worked fine:
================================================== ==================
Step 1. Create a test table
CREATE TABLE LOGIN_INFO
(
ID_LOGIN nvarchar(20) PRIMARY KEY,
PLAN_SEQUENCE int,
PLAN_SCHOOL nvarchar(20)
)
INSERT INTO LOGIN_INFO VALUES(N'SEQ11_NAME',11,N'SCHOOL11')
INSERT INTO LOGIN_INFO VALUES(N'SEQ12_NAME',12,N'SCHOOL12')
INSERT INTO LOGIN_INFO VALUES(N'SEQ13_NAME',13,N'SCHOOL13')
INSERT INTO LOGIN_INFO VALUES(N'SEQ14_NAME',14,N'SCHOOL14')
INSERT INTO LOGIN_INFO VALUES(N'SEQ21_NAME',21,N'SCHOOL21')
INSERT INTO LOGIN_INFO VALUES(N'SEQ22_NAME',22,N'SCHOOL22')
INSERT INTO LOGIN_INFO VALUES(N'SEQ23_NAME',23,N'SCHOOL23')
INSERT INTO LOGIN_INFO VALUES(N'SEQ24_NAME',24,N'SCHOOL24')
Step 2. Create a SSIS package in BIDS and run it
1. Drag an OLE DB Source to the Data Flow pane and have the connection
point to the test database and select the table LOGIN_INFO.
2. Drag a Pivot Transformation component to the Data Flow pane, drag the
green line from OLE DB Source to Pivot.
3. Double click the Pivot component and choose all the three columns as
Input Columns and then switch to the "Input and Output Properties" tab,
check and record the LineageID of every input column:
ID_LOGIN: 32
PLAN_SEQUENCE: 35
PLAN_SCHOOL: 38
then expand Pivot Default Output->Output Columns, click Add Column to add
the following columns:
Pivot Output (Name, PivotKeyValue, Source)
ID_LOGIN (none) 32
SEQ11_NAME 11 38
SEQ12_NAME 12 38
SEQ13_NAME 13 38
SEQ14_NAME 14 38
SEQ21_NAME 21 38
SEQ22_NAME 22 38
SEQ23_NAME 23 38
SEQ24_NAME 24 38
4.Click OK and drag an Excel Destination to specify an excel file to export
data, double click the component, click New... to specify the excel file,
click New... beside "Name of the Excel sheet" to create a new sheet with
the name LOGININFO, switch to Mappings, and click OK.
5. Run the package.
Step3. Check the Excel file to see if the output is correct.
================================================== ================
Anyway I admit that the warning is not friendly and informative, we welcome
you give Microsoft your feedback at https://connect.microsoft.com/sql so
that our product team can hear your voice closely and improve this feature
in future.
Hope this helps. If you have any other questions or concerns, please feel
free to let me know. Have a nice day!
Best regards,
Charles Wang
Microsoft Online Community Support
================================================== =========
Delighting our customers is our #1 priority. We welcome your
comments and suggestions about how we can improve the
support we provide to you. Please feel free to let my manager
know what you think of the level of service provided. You can
send feedback directly to my manager at: msdnmg (AT) microsoft (DOT) com.
================================================== =========
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for
non-urgent issues where an initial response from the community
or a Microsoft Support Engineer within 1 business day is acceptable.
Please note that each follow up response may take approximately
2 business days as the support professional working with you may
need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by
contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
================================================== ==========
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== =======