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 csv import error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-12-09, 05:30
lalupate lalupate is offline
Registered User
 
Join Date: Mar 2009
Posts: 3
bcp csv import error

Hello need help bcp import data
with datetime format
i create temprorary table with varchar column and try to convert this '20081031115548' to datetime format does not work.
any nice idea i have 10 millions of data to insert it
i am not success in bcp and couldnot create insert then i am
using vb application it is too slow time out occurs often.

original csv date is like this
0019,20081130,081104686,1,000001,01,20081130110152 ,2,530,,0,0.0000,0,530,0,0,530,600,70,505,,1,1,,1, ,0,,20081130110254,20081130110255,C0019F02,3003284 6,20062263,

here is the sample date plz help.
lalupate
Reply With Quote
  #2 (permalink)  
Old 04-12-09, 11:45
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
To convert your char to datetime use e.g.
select convert(datetime, stuff(stuff(stuff('20081031115548', 13,0,':'), 11,0,':'), 9,0,' '))
Reply With Quote
  #3 (permalink)  
Old 04-13-09, 02:07
lalupate lalupate is offline
Registered User
 
Join Date: Mar 2009
Posts: 3
thanks for response pdreyer,

Quote:
Originally Posted by pdreyer
To convert your char to datetime use e.g.
select convert(datetime, stuff(stuff(stuff('20081031115548', 13,0,':'), 11,0,':'), 9,0,' '))
it works for one datetime format but problem is how to use wildcard millions of different char data at once,
or changing csv file to insertable format.

thanks again
Reply With Quote
  #4 (permalink)  
Old 04-15-09, 01:50
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 1,268
I don't understand. You mean you don't have only ccyymmddhhmmss as a problem format? Your sample csv data has only this one problem format.
You can try to modify the csv file using something like awk (or maybe sed)
How is this file created? Can you not get it modified at the source?
Reply With Quote
  #5 (permalink)  
Old 04-25-09, 23:23
lalupate lalupate is offline
Registered User
 
Join Date: Mar 2009
Posts: 3
thanks again for the response

yeah, it is good idea ,hope will solve the problem using awk or sed.
these data is created by vb application retrive from ASA server in csv format and again vb application
insert or update to ase server. these process is ok for few data and daily routing basis, but in my case there is large size of data(2 -3 years ) thus takes few days.
so i was thinking not to use VB aplication
csv direct to ase using bcp
thats why i was looking for solution.

thanks
lalupate
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