SQLTeam.com | Weblogs | Forums

Run .exe in backend

sql2008

#1

How to run .exe file from SQL Server stored procedure and also pass parameters


#2

what are you attempting to do? can you expound on what that .exe will be doing?


#3

By using procedure ,i want to run my application or .exe file in background. so now i created one procedure:
Declare @Cmdstr as varchar(8000)
--Declare @Date as nvarchar(500)
--DECLARE @ODBCConn varchar(10)
SET @ODBCConn = 'TestDb'
Set @Date=Convert(nvarchar(50),getdate())
set @cmdstr='"Application_path\Application_name.exe"'
DECLARE @result int
EXEC @result=xp_cmdshell @cmdstr
IF (@result = 0)
PRINT 'Success'
ELSE
PRINT 'Failure'


#4

To get the execution result redirect outputs to text files and bcp them in to read and respond to the result cleanly.


#5

I was asking more about what the thing does, not the technical part, but for example "this exe ingests data into sql server" or "the exe generates xml or csv files"