| 
                
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 |  
                                    | justjohnoStarting Member
 
 
                                        23 Posts | 
                                            
                                            |  Posted - 2012-02-09 : 18:35:20 
 |  
                                            | I'm using the BCP command below from within DOS to export a table (Encounter) into a text file, using a pipe as the delimiter.  This has been working just fine until the character ":" was put into the table.  BCP now uses this as the delimiter.  When I run the command it will work fine until it gets to this character and skews the TXT file.bcp MEDASSETS..Encounter out "f:\MedAssets\daily_file_Tran\ENC.txt" -T -c -t"|"John O |  |  
                                    | justjohnoStarting Member
 
 
                                    23 Posts | 
                                        
                                          |  Posted - 2012-02-09 : 18:39:10 
 |  
                                          | I don't need to use BCP, If there is another way to get this done please point me in that direction.  I just need to get this into a "|" delimited file.John O |  
                                          |  |  |  
                                    | visakh16Very Important crosS Applying yaK Herder
 
 
                                    52326 Posts | 
                                        
                                          |  Posted - 2012-02-09 : 18:44:08 
 |  
                                          | you can use OPENROWSET also for this or even export import wizard------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |  
                                          |  |  |  
                                    | justjohnoStarting Member
 
 
                                    23 Posts | 
                                        
                                          |  Posted - 2012-02-09 : 18:47:32 
 |  
                                          | Thanks for the reply, I've never used OPENROWSET.  Let me check it out and see what I can do.John O |  
                                          |  |  |  
                                    | russellPyro-ma-ni-yak
 
 
                                    5072 Posts | 
                                        
                                          |  Posted - 2012-02-09 : 21:33:01 
 |  
                                          | are you sure there isn't a pipe in the file?  a colon shouldn't break the format if pipe is the delimiter.why not use a more unlikely delimiter? |  
                                          |  |  |  
                                    | justjohnoStarting Member
 
 
                                    23 Posts | 
                                        
                                          |  Posted - 2012-02-10 : 11:52:19 
 |  
                                          | I hate to sound so green, but looking into this further it appears to be return characters that's causing it skew and not the ":" delimiter.  If I look at the result, it returns "BOX" Character.  If I look at the front end the text is in several lines in a single field.  Thanks for helping through this.  I'm going create a script to search for the return and replace with space. Is there an easier way?John O |  
                                          |  |  |  
                                    | visakh16Very Important crosS Applying yaK Herder
 
 
                                    52326 Posts | 
                                        
                                          |  Posted - 2012-02-10 : 11:59:47 
 |  
                                          | quote:yep useREPLACE(REPLACE(yourfield,CHAR(10),' '),CHAR(13),' ')------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/Originally posted by justjohno
 I hate to sound so green, but looking into this further it appears to be return characters that's causing it skew and not the ":" delimiter.  If I look at the result, it returns "BOX" Character.  If I look at the front end the text is in several lines in a single field.  Thanks for helping through this.  I'm going create a script to search for the return and replace with space. Is there an easier way?John O
 
 |  
                                          |  |  |  
                                    | justjohnoStarting Member
 
 
                                    23 Posts | 
                                        
                                          |  Posted - 2012-02-10 : 15:36:21 
 |  
                                          | Exactly visakh16, that's what took care of it.Thanks everyone for the help.  It now works.John O |  
                                          |  |  |  
                                |  |  |  |  |  |