Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 SQL BCP

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-03-26 : 07:32:56
ahmed writes "Hi
When im trying to use BCP below example

DECLARE @FileName varchar(50),
@bcpCommand varchar(2000)

SET @FileName = REPLACE('c:\authors_'+CONVERT(char(8),GETDATE(),1)+'.txt','/','-')

SET @bcpCommand = 'bcp "SELECT * FROM pubs..authors ORDER BY au_lname" queryout "'
SET @bcpCommand = @bcpCommand + @FileName + '" -U garth -P pw -c'

EXEC master..xp_cmdshell @bcpCommand

i got the following output

'bcp' is not recognized as an internal or external command,
operable program or batch file.
NULL"

samsekar
Constraint Violating Yak Guru

437 Posts

Posted - 2003-03-26 : 07:56:02
c:\authors_03-26-03.txt
bcp "SELECT * FROM pubs..authors ORDER BY au_lname" queryout "c:\authors_03-26-03.txt" -U sa -P fair -c

Your code works perfectly for me.
Are you able to run bcp directly in the command prompt?


Sekar
~~~~
Success is not a destination that you ever reach. Success is the quality of your journey.
Go to Top of Page
   

- Advertisement -