jrp210


I have a table which has been loaded from various source feeds. The SourceId relates to the source name and the SourceCompanyId is the sources primary key for the company. I am basically trying to create one row with all the SourceCompanyIds in my column headers. What data flow tasks would be necessary in SSIS

The structure of the final table is:

CREATE TABLE [dbo].[Company](

[CompanyId] [int] IDENTITY(1,1) NOT NULL,
[CompanyName] [varchar](75),
[CIK] [varchar](10),
[Ticker] [varchar](10),
[Source1CompanyId] [int] NULL,
[Source2CompanyId] [int] NULL,
[Source3CompanyId] [int] NULL,
[Source4CompanyId] [int] NULL,
[Source5CompanyId] [int] NULL,
[Source6CompanyId] [int] NULL,

CONSTRAINT [PK_Company] PRIMARY KEY CLUSTERED

(
[CompanyId] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

=================================

The table in which contains all the company data

CREATE TABLE [dbo].[SourceCompany](

[SourceId] [int] NOT NULL,
[SourceCompanyId] [varchar](10) ,
[SourceCompanyName] [varchar](75),
[CIK] [varchar](10),
[Ticker] [varchar](10),

CONSTRAINT [PK_SourceCompany] PRIMARY KEY CLUSTERED

(
[SourceId] ASC,
[SourceCompanyId] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]




Re: Which Data Flow task to use?

Phil Brammer


So you want data to be your column names Not going to happen. At least not with out-of-the-box tools in SSIS.






Re: Which Data Flow task to use?

Rafael Salas

See if the Unpivot component can do sothing for you...

http://msdn2.microsoft.com/en-us/library/ms141723.aspx







Re: Which Data Flow task to use?

jrp210

I would need to pivot the data in this case though. Its normalized now with mulitple rows of companies having different company ids.



Re: Which Data Flow task to use?

Phil Brammer

jrp210 wrote:
I would need to pivot the data in this case though. Its normalized now with mulitple rows of companies having different company ids.


Then there's always the pivot transformation.