xp_cmdshell exec ssis package in 32bit mode

  • I have a package set to run in 32bit mode on a 64bit machine, and I need to put it in a stored procedure.

    I can run the package in cmd prompt like:

    "c:\program files (x86))\microsoft sql server\100\dts\binn\dtexec.exe" /f "c:\users\user1\desktop\package.dtsx"

    I can also run a test package built in 64bit like:

    declare @cmdtest varchar(200)

    set @cmdtest = 'dtexec /f "C:\Users\user1\Desktop\testpackage.dtsx"'

    exec master..xp_cmdshell @cmdtest

    but when I run the one built in 32bit mode like:

    declare @cmd varchar(200)

    set @cmd = ' "c:\program files (x86)\microsoft sql server\100\dts\binn\dtexec.exe" /f "C:\Users\user1\Desktop\package.dtsx" '

    exec master..xp_cmdshell @cmd

    I got an error:

    'c:\program' is not recognized as an internal or external command.

    any idea? Thanks

  • It looks fine. Have you tried removing the leading space and the trailing space?

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • its is happening because of white spaces in folder's name "program files"

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • I removed the leading and trailing space, still got the same error.

    I thought double quotes would take care of spaces between folder names like "program files".

  • double quotes does take care of it. Where are you making this call? From ssms? From sqlagent? From somewhere else?

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • from ssms

  • what do you get if you print the variable to screen after setting it?

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • here is the error:

    'C:\Program' is not recognized as an internal or external command,

    operable program or batch file.

    NULL

    the package has script task to execute crystal reports

  • comment out your exec statement and just print the variable

    Like this:

    print @cmd

    Post the result of that print statement

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • "C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\dtexec.exe" /f "C:\Users\user1\Desktop\package.dtsx"

  • That seems to print fine. I have seen it in the past where it was throwing that error but was actually referring to the second set of items being quoted (the stuff you have after the /f). Try it without quoting that second file path.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • wow! thank you so much.

    it worked without double quotes in the second part.

  • Excellent - glad it worked.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Hi,

    How to add parameters to run the package?

  • springmoonjc (7/20/2012)


    Hi,

    How to add parameters to run the package?

    I got it. Thanks. 🙂

Viewing 15 posts - 1 through 15 (of 19 total)

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