Solved

Datefield in BCP in.

Posted on 1998-09-30
9
448 Views
Last Modified: 2011-09-20
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.
0
Comment
Question by:lizzzard
  • 4
  • 3
  • 2
9 Comments
 
LVL 7

Expert Comment

by:spiridonov
ID: 1098320
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.
0
 

Author Comment

by:lizzzard
ID: 1098321
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.
0
 
LVL 7

Expert Comment

by:spiridonov
ID: 1098322
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.
0
 
LVL 3

Expert Comment

by:knel1234
ID: 1098323
Is your bcp using a seperator or a format file?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:lizzzard
ID: 1098324
Preferrably a format file.
0
 
LVL 7

Expert Comment

by:spiridonov
ID: 1098325
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
0
 
LVL 3

Accepted Solution

by:
knel1234 earned 50 total points
ID: 1098326
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
0
 
LVL 3

Expert Comment

by:knel1234
ID: 1098327
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
0
 
LVL 3

Expert Comment

by:knel1234
ID: 1098328
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

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Unable to get exact error from Sybase Sp to Sql Server 2005 2 385
Sybase SQL Syntax 2 275
SQL Query Help! 11 116
Not able to use a TRUNCATE command in 4 46
Facing problems with you memory card? Cannot access your memory card? All stored data, images, videos are lost? If these are your questions...than this small article might help you out in retrieving your lost or inaccessible data.
Fine Tune your automatic Updates for Ubuntu / Debian
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now