SQL 2000 xp_cmdshell bcp does not return data while xp_cmdshell DIR works fine

  • I have verified that the user has local admin privileges; execute on master and equote databases.

    The first Directory xp_cmdshell creates the test6.txt file perfectly.

    The second bcp xp_cmdshell statement returns 128 in @rc and does nothing else that I know of.

    I have been working on various scenarios for days. Any help would be appreciated.

    set nocount on

    declare @cmd varchar(255),

    @rc int

    exec master..xp_cmdshell '"dir c:\*.* > C:\temp\test6.txt"'

    set @cmd = 'bcp "select * from equote.dbo.Country" queryout "C:\temp\test6b.txt" -c, -t, -d equote, -S Spidertel10' -- DOES NOT WORK

    select * from equote.dbo.Country

    exec @rc = master..xp_cmdshell @cmd

    print 'cmd: ' + @cmd

    print @rc

    Grid Output: Null, correct list of Countries, Null

    Messages:

    cmd: bcp "select * from equote.dbo.Country" queryout "C:\temp\test6b.txt" -c, -t, -d equote, -S Spidertel10

    128

Viewing 0 posts

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