SSIS Execute Process

Last Post 05 Nov 2010 05:50 AM by presz. 1 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
New Member
New Member

05 Nov 2010 12:29 AM

In my SSIS package, I need to execute a .bat file which runs a command and then I want to log the output (stdout) from the command into a sql table.

Is anyone able to help me out/give me some pointers? I am able to run the bat file, I just can't figure out how to store the output in a table.

New Member
New Member

05 Nov 2010 05:50 AM

You can call xp_cmdshell stored procedure and store result in temp table. You will have to enable option to run "xp_cmdshell", if not done already.

Here is some code I use to read contents of directory.

create table #temp (fname varchar(500))
insert into #temp exec xp_cmdshell 'dir /b c:\'

Once in temp table, you can move the contents to another table.

Place all of this in Execute SQL task in SSIS package.

Acceptable Use Policy