dbTalk Databases Forums  

problem importing csv

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss problem importing csv in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
rk
 
Posts: n/a

Default problem importing csv - 07-02-2003 , 04:56 PM






SQL gurus, please help...

I am trying to import a .csv which has date and time in a
column in the format "01Jan00:00:01".

When I specify the field to be datetime in SQL, I get
errors saying that a string cannot be converted to
datetime.

any help would be much appreciated.

thanks,
Raj

Reply With Quote
  #2  
Old   
Andrew J. Kelly
 
Posts: n/a

Default Re: problem importing csv - 07-02-2003 , 06:16 PM






Try replacing the Month (Jan, Feb etc) with the proper month digits (01, 02
etc). You probably want to use /'s before and after the month along with
the year such as: 01/01/2003
You also need a space between the year and the beginning of the time like
this: '01/01/2003 00:00:01'


--

Andrew J. Kelly
SQL Server MVP


"rk" <rajkris27 (AT) yahoo (DOT) com> wrote

Quote:
SQL gurus, please help...

I am trying to import a .csv which has date and time in a
column in the format "01Jan00:00:01".

When I specify the field to be datetime in SQL, I get
errors saying that a string cannot be converted to
datetime.

any help would be much appreciated.

thanks,
Raj



Reply With Quote
  #3  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: problem importing csv - 07-03-2003 , 01:03 AM



Hello, rk!

The way i would probablt attack this would be like this

Formatting Character Data into Datetime fields
http://www.sqldts.com/default.aspx?6,103,249,0,1

--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org

: I am trying to import a .csv which has date and time in a
: column in the format "01Jan00:00:01".

: When I specify the field to be datetime in SQL, I get
: errors saying that a string cannot be converted to
: datetime.

: any help would be much appreciated.

--- Microsoft CDO for Windows 2000



Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.