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.
    
        
            
                
                    
                        
                            
                                | Author | 
                                
                                 Topic  | 
                             
                            
                                    | 
                                         sharmar 
                                        Starting Member 
                                         
                                        
                                        2 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2015-03-16 : 18:12:34
                                            
  | 
                                             
                                            
                                            | HiI 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 followingexec 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?ThanksSharma | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     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 KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     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  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                       
                          
                            
                                    | 
                                     tkizer 
                                    Almighty SQL Goddess 
                                     
                                    
                                    38200 Posts  | 
                                    
                                      
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |