Solved

Call Exe or batch file in a trigger or in a store procedure

Posted on 2003-11-06
4
1,229 Views
Last Modified: 2012-06-27
I would like to know if i can call a program EXE (.exe) or a batch file (.bat) by in Trigger or a Store Procedure. If so, how? Thanks
0
Comment
Question by:lussier
  • 2
  • 2
4 Comments
 
LVL 58

Expert Comment

by:amit_g
ID: 9696408
You can call extended stored procedure xp_cmdshell.

EXEC master..xp_cmdshell 'dir *.exe'
0
 
LVL 15

Accepted Solution

by:
namasi_navaretnam earned 500 total points
ID: 9696464
EXEC master..xp_cmdshell 'c:\yourbatchfile.bat'

This file ('c:\yourbatchfile.bat'
) should be on the PC where sql server is installed
0
 
LVL 58

Expert Comment

by:amit_g
ID: 9696650
lussier, you are new to this forum but for the next time please note that if you have more than one identical answers, accept either the first one or split the point between all of them. Please spend few minutes reading the help ...

http://www.experts-exchange.com/help.jsp#hi19
0
 
LVL 15

Expert Comment

by:namasi_navaretnam
ID: 9696805
Agree with Amit. I did not see your response. i have mutiple windows opened and some times i do not see what  others have posted. But I think, lussier picked a more specific answer in this case though.

Regards.
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question