dbTalk Databases Forums  

Bulk Insert in Execute SQL Task w/ variable filename

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


Discuss Bulk Insert in Execute SQL Task w/ variable filename in the microsoft.public.sqlserver.dts forum.



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

Default Bulk Insert in Execute SQL Task w/ variable filename - 01-05-2004 , 08:47 PM






Hi all-

I'm trying to run a BULK INSERT through an Execute SQL task (I need to
call it from Exec SQL to enable triggers). The problem I'm running
into is that the import filename is variable. I'm calling the DTS
package through a DOS batch file which cycles through a directory and
calls DTSRUN for each file. Thus, the filename is passed in from the
batch file with the /A switch as a GV.

I tried using a third party DLL that allowed me to pass in GVs through
ActiveX, but I couldn't get it to work.

Basically I have a DTS package with a connection to my SQL server, and
an Execute SQL task with the following code:
BULK INSERT table
FROM @filename
WITH (FIRE_TRIGGERS, FORMATFILE='c:\format.fmt')

I also tried using the parameters in the Execute SQL Task, but read
that you can't use that to pass in a filename.

Any help would be greatly appreciated.

Thanks!
B

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

Default Re: Bulk Insert in Execute SQL Task w/ variable filename - 01-06-2004 , 02:33 AM






You can build the statement in a piece of Active Script

You want the SQLStatement of the ExecuteSQL task

Global Variables and SQL statements in DTS
(http://www.sqldts.com/default.aspx?205)

--

----------------------------
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



"Big Brother" <jonasb (AT) alum (DOT) rpi.edu> wrote

Quote:
Hi all-

I'm trying to run a BULK INSERT through an Execute SQL task (I need to
call it from Exec SQL to enable triggers). The problem I'm running
into is that the import filename is variable. I'm calling the DTS
package through a DOS batch file which cycles through a directory and
calls DTSRUN for each file. Thus, the filename is passed in from the
batch file with the /A switch as a GV.

I tried using a third party DLL that allowed me to pass in GVs through
ActiveX, but I couldn't get it to work.

Basically I have a DTS package with a connection to my SQL server, and
an Execute SQL task with the following code:
BULK INSERT table
FROM @filename
WITH (FIRE_TRIGGERS, FORMATFILE='c:\format.fmt')

I also tried using the parameters in the Execute SQL Task, but read
that you can't use that to pass in a filename.

Any help would be greatly appreciated.

Thanks!
B



Reply With Quote
  #3  
Old   
John Q. Public
 
Posts: n/a

Default Re: Bulk Insert in Execute SQL Task w/ variable filename - 02-07-2004 , 06:57 PM



Or you can use a dynamic properties task to modify the SQL statement.

Joe Duncan

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
You can build the statement in a piece of Active Script

You want the SQLStatement of the ExecuteSQL task

Global Variables and SQL statements in DTS
(http://www.sqldts.com/default.aspx?205)

--

----------------------------
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



"Big Brother" <jonasb (AT) alum (DOT) rpi.edu> wrote in message
news:79c1dbe1.0401051747.50fb1848 (AT) posting (DOT) google.com...
Hi all-

I'm trying to run a BULK INSERT through an Execute SQL task (I need to
call it from Exec SQL to enable triggers). The problem I'm running
into is that the import filename is variable. I'm calling the DTS
package through a DOS batch file which cycles through a directory and
calls DTSRUN for each file. Thus, the filename is passed in from the
batch file with the /A switch as a GV.

I tried using a third party DLL that allowed me to pass in GVs through
ActiveX, but I couldn't get it to work.

Basically I have a DTS package with a connection to my SQL server, and
an Execute SQL task with the following code:
BULK INSERT table
FROM @filename
WITH (FIRE_TRIGGERS, FORMATFILE='c:\format.fmt')

I also tried using the parameters in the Execute SQL Task, but read
that you can't use that to pass in a filename.

Any help would be greatly appreciated.

Thanks!
B





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.