Import data with a package variable to SQL destination -
12-13-2006
, 05:49 AM
Hi there,
Using SQL Server 2005 SP1. I need to import a bunch of csv files into one sql server table using SQL Server
Integration Services. Each csv file contains price data for a financial market. The SQL Server table
definition is:
CREATE TABLE [dbo].[dt5min](
[market] [char](2) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Date] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Time] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Open] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[High] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Low] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Close] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
CONSTRAINT [PK_dt5min] PRIMARY KEY CLUSTERED
(
[market] ASC,
[Date] ASC,
[Time] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
The csv file headings are Date, Time, Open, High, Low, Close but no market code. As each file is a different
market, what I want to do is create a variable and set the variable to the market code for each import that I
do. So I need to map the market code variable to the market destination column.
I have created a Data Flow task with a flat file source pointing to the file I want to import. This has a
precedence constraint mapped to the SQL Server table destination defined above. Somewhere in there I need to
map the variable to ther market column.
I have no idea how to do that. Please point me in the right direction, thanks. |