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
 General SQL Server Forums
 New to SQL Server Programming
 BCP Utility Doesn't work with View

Author  Topic 

sharmar
Starting Member

2 Posts

Posted - 2015-03-16 : 18:12:34
Hi

I am using BCP utility to export data from a view to text file. I get the following error
"Copy direction must be either r 'in', 'out' ..." when I execute the following

exec master..xp_cmdshell 'bcp [Salesforce_Prod].[dbo].[Project With Opps] out c:\test99.txt -c -t, -T -S'

The same thing work if I replace the view in the statement above with a table name.

Any insight what could be wrong?
Thanks
Sharma

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-03-16 : 18:16:40
I suspect it's due to the spaces in the table name even though the object has brackets around it. Create a new view without the spaces to see if the error goes away. If the error does go away, it's a bug with bcp.exe, IMO.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

sharmar
Starting Member

2 Posts

Posted - 2015-03-17 : 12:13:58
I created a new view without space and it worked! thank you so much, Tara.

Sharma R


Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2015-03-17 : 12:22:16


Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -