dbTalk Databases Forums  

How to pass data from fixed len records file to stored proc in DTS package

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss How to pass data from fixed len records file to stored proc in DTS package in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Natalie
 
Posts: n/a

Default How to pass data from fixed len records file to stored proc in DTS package - 11-09-2003 , 08:11 PM






Hi,
I am new to DTS programming. Project I am working on
requires me to create a stored procedure (sql server 2000)
that would import data from a fixed length records text
file to a table using DTS package. Based on primary key
input parameter, stored procedure should update existing
record if found, or insert a new one.
I created a dts package using the DTS designer and added
Text File data source, Microsoft OLEDBProvider for
SQLServer destination connection. I have a stored
procedure to update or insert records. I am looking for
the way to feed records from the text file source to the
ExecuteSQLTask. I created package global variables and was
hoping to write file source data to the global variables
and then use them as input parameters to the
ExecuteSQLTask. But I can't find the way to assign file
data to the variables.

I would appreciate your help in this matter.

Natalie


Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: How to pass data from fixed len records file to stored proc in DTS package - 11-09-2003 , 08:51 PM






I personally would BULK INSERT the text file into a SQL Server working
table. I would then use TSQL statements to do the manipulations

--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Natalie" <nlitvino (AT) cogeco (DOT) ca> wrote

Quote:
Hi,
I am new to DTS programming. Project I am working on
requires me to create a stored procedure (sql server 2000)
that would import data from a fixed length records text
file to a table using DTS package. Based on primary key
input parameter, stored procedure should update existing
record if found, or insert a new one.
I created a dts package using the DTS designer and added
Text File data source, Microsoft OLEDBProvider for
SQLServer destination connection. I have a stored
procedure to update or insert records. I am looking for
the way to feed records from the text file source to the
ExecuteSQLTask. I created package global variables and was
hoping to write file source data to the global variables
and then use them as input parameters to the
ExecuteSQLTask. But I can't find the way to assign file
data to the variables.

I would appreciate your help in this matter.

Natalie




Reply With Quote
  #3  
Old   
Darren Green
 
Posts: n/a

Default Re: How to pass data from fixed len records file to stored proc in DTS package - 11-09-2003 , 08:56 PM



In article <02e101c3a730$03887850$a501280a (AT) phx (DOT) gbl>, Natalie
<nlitvino (AT) cogeco (DOT) ca> writes
Quote:
Hi,
I am new to DTS programming. Project I am working on
requires me to create a stored procedure (sql server 2000)
that would import data from a fixed length records text
file to a table using DTS package. Based on primary key
input parameter, stored procedure should update existing
record if found, or insert a new one.
I created a dts package using the DTS designer and added
Text File data source, Microsoft OLEDBProvider for
SQLServer destination connection. I have a stored
procedure to update or insert records. I am looking for
the way to feed records from the text file source to the
ExecuteSQLTask. I created package global variables and was
hoping to write file source data to the global variables
and then use them as input parameters to the
ExecuteSQLTask. But I can't find the way to assign file
data to the variables.

I would appreciate your help in this matter.

Natalie


To link a text file source to a SQL connection you need to use a data
transfer capable task, not the Execute SQL Task. This will allow you to
perform row by row processing, calling the procedure with the 1 row of
data at a time.

Try the Data Driven Query task. In the transform script pass out the
values you wish to use as you procedure input values, then map the
parameter to your procedure in the SQL. Have a read of Books Online
first to get a better understanding of how the task works.

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.