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)
 BCP Fails in code

Author  Topic 

dav101
Starting Member

10 Posts

Posted - 2004-06-02 : 12:33:15
The following code fails when I run it in QA but if I copy and paste into the DOS window it works. Has me stumped. Any Ideas that I'm missing?? The file is not created.

SET @EXPORTSQL='bcp "Select sData from jeff.dbo.ccarout order by Lno" queryout c:\Oshea.txt -c -S"homeSrv" -U"username" -P"password"'

EXEC MASTER..XP_CMDSHELL @EXPORTSQL

This is the grid results
NULL
Starting copy...
NULL
1 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.): total 1
NULL


Mike

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-02 : 12:55:26
When you run it in Query Analyzer, it is executing on the database server and not on your client machine. The file is being created on the database server.

Tara
Go to Top of Page

dav101
Starting Member

10 Posts

Posted - 2004-06-02 : 13:04:13
Tara,
Thankyou,Thankyou,Thankyou
Mike (aka the dum one)

Mike
Go to Top of Page
   

- Advertisement -