copying out packages with spaces in name

  • I am trying to write a script to copy out all my SSIS packages in msdb out to the file system., using DTUTIL. I have it working except where the package name contains spaces, this leads to 'invalid parameter' errors, e.g

    exec master.dbo.xp_cmdshell 'DTUTIL /SQL DAPA AVS File Creation /COPY FILE;e:\server\data\mssql\dba_scripts\disrec\dts\DAPA AVS File Creation.dtsx /Q'

    fails because AVS is interpreted as a parameter.

    I have tried [] {}, "", how can I get around this?

    ---------------------------------------------------------------------

  • have I flummoxed the SQL world again or is the question not clear?

    ---------------------------------------------------------------------

  • Surround the package name in double quotes

  • I have tried double quotes, square brackets and curly barackets, all to no effect.

    I would really like to get this working for DR purposes and because I have seen anumber of requests on this site for a script to do this

    ---------------------------------------------------------------------

  • Try this:

    exec master.dbo.xp_cmdshell 'DTUTIL /SQL "DAPA AVS File Creation" /COPY FILE;"e:\server\data\mssql\dba_scripts\disrec\dts\DAPA AVS File Creation.dtsx" /Q'

    Without the quotes I get an error of Option AVS is not valid

    With the quotes I get Could not find the package "DAPA AVS File Creation"

    This means that the command line is being processed correctly but I don't have that package

  • thanks chris, that did it. The actual difference was I did not have quotes around the output file either, adding those makes it work.

    I'll post the script to this site, if you want it directly let me know, maybe you can improve it, I'm no great coder.

    ---------------------------------------------------------------------

Viewing 6 posts - 1 through 5 (of 5 total)

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