xp_cmdshell problems

  • Hi guys.

    I have this script in which I am attempting to run a VB executable.

    DECLARE @CommandString AS VARCHAR(100)

    DECLARE @Date AS VARCHAR(50)

    SET @Date = convert(varchar,Year(GetDATE())) + '-' + right('00' + convert(varchar,Month(DATEADD(m,-1,GETDATE()))),2) + '-' + right('00' + convert(varchar,Day(GetDATE())),2)

    SET @CommandString = '"C:\Program Files\AggCash\aggcashflow.exe"' + ' /' + @Date + ' /False'

    EXEC master.dbo.xp_cmdshell @CommandString

    When ever I try to run this code, the program executes but doesnt process ( as I can see in the task manager the CPU usage is zero ). However when I do a print command of @commandstring and use that string directly in the dos environment it works perfectly.

    This would rule out problems with my VB code and passing of parameters. So I suspect there might be something going on with xp_cmdshell. Has anybody had similiar troubles or know a fix?

    Thanks in advance.

  • Under what user context does the VB app run (context of the user or as a service account)? How does it connect to SQL Server (SQL Server login/Windows authentication)?

    K. Brian Kelley
    @kbriankelley

  • Make sure that SQL Server Account has rights to read and execute the app on that folder.


    * Noel

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply