Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SQL 2000 xp_cmdshell bcp does not return data while xp_cmdshell DIR works fine Expand / Collapse
Author
Message
Posted Monday, September 30, 2013 11:31 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, October 01, 2013 4:22 PM
Points: 1, Visits: 22
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
Post #1500127
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse