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
 SQL Server Development (2000)
 BCP error

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-09-07 : 11:57:41
Javier writes "I extracted this code from you and I made some changes

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

SET @FILENAME = 'zz.txt'

SET @bcpCommand = 'bcp "SELECT * FROM XMSDAR..Tbl_XMSDARHistory " queryout " '
SET @bcpCommand = @bcpCommand + @FileName + '" -U sa -P -c'

EXEC master..xp_cmdshell @bcpCommand
output ------------------------------------------------------------
NULL
Starting copy...
NULL
5 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.): total 1 Avg 0 (5000.00 rows per sec.)

(6 row(s) affected)
But I can not find the file zz.txt

When I modified set @filename = 'c:\zz.txt' I got this error
output ------------------------------------------------------------
SQLState = S1000, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Unable to open BCP host data-file

(2 row(s) affected)

Any Idea what is happening with this code??
Thankyou"
   

- Advertisement -