SQLTeam.com | Weblogs | Forums

Run .exe in backend

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

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

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'

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

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"