• Sigerson (3/1/2013)


    This is a related question, hoping someone on this thread can answer it.

    I've had a working bcp process for months that creates a CSV file on a network drive. Here's the command:

    'bcp "exec [dbname].[dbo].ExtractData" queryout ' + @destFolder + @fileName + ' -t \, -T -c'

    When @destFolder = "\\[server_name]\UploadFiles" it works

    If I change @destFolder to: "\\[server_name]\9 Auto Generated Upload Files\" with spaces in the folder name, it doesn't work.

    I can work around this, but does anyone know of a way to force bcp to accept spaces in the destination folder?

    Thanks in advance,

    it's the usual command line thing: files or paths that contain spaces must be wrapped with double quotes

    your code modified:note the dbl quotes that make up the path+file, and also for the t delimiter

    'bcp "exec [dbname].[dbo].ExtractData" queryout "' + @destFolder + @fileName + '" -t "\", -T -c'

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!