Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


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


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

Author
Message
mreynolds 88837
mreynolds 88837
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search