wally_davis
asked on
Getting NULL Output when passing text file to a console application as an Arg
I'm passing a text file name into a variable in a SP that will then forward that name and append it to a console application for processing. As far as I can see the code looks right but, I get a NULL Output when I EXEC the SP. My console application is in .NET Visual C#. Do I need to add an @ symbol or will the path info be parsed correctly?
Thanks for your help Experts.
Wally
Thanks for your help Experts.
Wally
USE [DMS]
GO
/****** Object: StoredProcedure [dbo].[RunPingUtil] Script Date: 04/06/2009 08:30:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[RunPingUtil]
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Workstations varchar(max)
SET @Workstations = '\\Crprchblgsrd\d$\ProofOfConcept\data.txt'
DECLARE @CommandLine sysname;
SET @CommandLine = '\\Crprchblgsrd\d$\ProofOfConcept\ProofOfConcept.exe ' + @Workstations + '';
EXEC xp_cmdshell @CommandLine;
END
ASKER
ok, well, by verification of the output, -->
\\Crprchmsqdve\d$\ProofOfC oncept\Pro ofOfConcep t.exe data.txt
I would have thought the ProofOfConcept would have processed the data inside the txt file but it in fact has not when I want to check table on the database. I made sure that the data I entered into the text file had \r\n Escape sequences replaced in such a way that the workstation names were processed correctly. So, I still can't understand why, if the SP passes the filename to the executable correctly it should work. Any ideas why it isn't being processed?
\\Crprchmsqdve\d$\ProofOfC
I would have thought the ProofOfConcept would have processed the data inside the txt file but it in fact has not when I want to check table on the database. I made sure that the data I entered into the text file had \r\n Escape sequences replaced in such a way that the workstation names were processed correctly. So, I still can't understand why, if the SP passes the filename to the executable correctly it should work. Any ideas why it isn't being processed?
I assume you want to pass some information to the executable via command line.But what are you trying to achieve.First of all you are trying to execute a exe in a shared path which will lead to lot of security issues.
What exactly are you trying to do?
What exactly are you trying to do?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thats exactly I am saying,Unless you map the path you might not be able to execute the exe with UNC it will not work.So I thought I should get points for this.
Open in new window