SSIS Execute Process

Last Post 05 Nov 2010 06:50 AM by presz. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
JE
New Member
New Member

--
05 Nov 2010 01:29 AM
Hi,

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.

thanks
presz
New Member
New Member

--
05 Nov 2010 06: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.
You are not authorized to post a reply.

Acceptable Use Policy