• Charlie I only see two things.

    i think the call to the procedure has to be fully qualified, i always put the servername.schemaname, but that might not be an issue.

    the other thing i see that doesn't match my examples, is where i expect the -r or -t row and field terminators to be in double quotes...yours doesn't look like it did (i know the forum strips slahs-n unless you htmlize it)...but i'd expect the dbl quotes.

    i just tested the example below, and it works fine.

    DECLARE @sql varchar(2000),

    @filename varchar(200)

    SET @sql = 'EXEC Sandbox.dbo.sp_find ''act'' '

    set @filename = 'c:\data\myfile.xml '

    --put it all together

    --flags -w wide format

    --t custom field terminator

    --r custom row terminator

    --U username

    --Ppassword

    --S server

    SET @sql = 'bcp "' + @sql + '" queryout "' + @filename + '" -w -t"|" -r"\n" -Ulowell -PNotTheRealPassword -SDEV223'

    EXEC Master..xp_CmdShell @SQL

    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!