Link to home
Start Free TrialLog in
Avatar of lizzzard
lizzzardFlag for Netherlands

asked on

Datefield in BCP in.

Hi,

How can I, using BCP in, import an ASCII file containing a date in DD/MM/YYYY format into a SYBASE datetime-field.
Thanks in advance.
Avatar of Victor Spiridonov
Victor Spiridonov
Flag of Russian Federation image

On  the workstation, from which you are going to run bcp in  control panel -->'Regional settings' you need to define short date format exactly the same way as it is stored in your text file.
Avatar of lizzzard

ASKER

Hi,

Thanks for your answer,but I'm afraid we are using Sybase on AIX. I should have said so. Now I'm not sure what to change.
I didn't have any experience with Sybase on AIX, but I had similar problem with Informix on AIX. I solved by setting DBDATE  AIX enviroment variable to the format i wanted. I think there should be something similiar for Sybase.
Is your bcp using a seperator or a format file?
Preferrably a format file.
I think your problem is, that your system date representation is different from the date representation in the file .For example your system date is defined as MM/DD/YY and in your file it is DD/MM/YY or MM.DD.YY
ASKER CERTIFIED SOLUTION
Avatar of knel1234
knel1234
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
lizzzard,

I assume that you have not received an answer yet.....
I am running Sybase on 11.0.2.2 on HP-UX.....

I have tested the following and It should work....
( sorry I would have gotten back earlier, but I was busy and I would have thought you would have gotten an answer already)

for the test table:
create table eetest (
datefld datetime,
strfld char(20) )

format file
10.0
2
1 SYBCHAR 1 10 "\","   1 int
2 SYBCHAR 1 10 "\"\n" 2 char

sample datafile
"01/11/1998","date1"
"02/11/1998","date2"
"03/11/1998","date3"
"04/11/1998","date4"
"05/11/1998","date5"

I assume that you know how to run the bcp utility on AIX
if you have any questions let me know.....

knel1234
lizzzard,

was the information that I provided helpful.  If it was,
could you please unlock the question.  If you still have
any questions/concerns let me know. I could use the
credit.......

knel1234