If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > bcp leaving out the last column which is null while extracting from the table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-03-11, 08:29
orrion orrion is offline
Registered User
 
Join Date: May 2011
Posts: 2
bcp leaving out the last column which is null while extracting from the table

Hello All,
I'm using BCP out utility for creating a data file in which I have kept '|' as the column delimiter and '\n' as row delimiter. My bcp command looks like :

bcp temp_table out /dir/$FILENAME -c -Uabc -S$SERVER -P$PASSWORD -c -t "|" -r "\r\n"

There are 7 columns in the table and i'm expecting 7 delimiters to be shown in data file. But I'm getting only 6 delimiters when I used the above command. Since the last column in NULL I'm getting such a result . I'm getting the output as :

a|abca|hi|def|hello|1536|
But I want as :
a|abca|hi|def|hello|1536||

Please help me on this
Reply With Quote
  #2 (permalink)  
Old 05-03-11, 09:21
mike_bike_kite mike_bike_kite is offline
vaguely human
 
Join Date: Jun 2007
Location: London
Posts: 2,519
Quote:
Originally Posted by orrion View Post
There are 7 columns in the table and i'm expecting 7 delimiters to be shown in data file.
I think it's your expectations that are wrong! If you had 2 columns then there would be one delimiter between the first and second columns. Similarly there would be 6 separators for a table of 7 columns ie

col1|col2|col3|col4|col5|col6|col7
__________________
Mike
Reply With Quote
  #3 (permalink)  
Old 05-06-11, 15:55
Pat Phelan Pat Phelan is online now
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,610
Mike is correct, if you have seven columns then you should only have sx column delimiters (between the columns) and one row delimiter (at the end of the row).

-PatP
__________________
In theory, theory and practice are identical. In practice, theory and practice are unrelated.
Reply With Quote
  #4 (permalink)  
Old 05-06-11, 16:29
orrion orrion is offline
Registered User
 
Join Date: May 2011
Posts: 2
Thanks for ur replies ..
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On