dbTalk Databases Forums  

trouble exporting time from access to sql server

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


Discuss trouble exporting time from access to sql server in the microsoft.public.sqlserver.dts forum.



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

Default trouble exporting time from access to sql server - 01-06-2004 , 09:17 PM






Hi,

I've been having this problem. I'm trying to export a
series of date and time from ms access to sql server but
can only manage to export the date but not the time as the
date and time are two separate columns. The error that I
receive after execution in sql server is that there is
an "invalid character value for cast specification".

Please help, thanks.


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

Default Re: trouble exporting time from access to sql server - 01-07-2004 , 01:28 AM






Oh Dear

This comes up an awful lot not just from Access but nearly every system you
will encounter has different ranges of dates it allows and they will
eventually come unstuck

So you hold/Access holds dates and times in two different attributes. We
are going to have to concatenate them


declare @dt varchar(50)
declare @tm varchar(50)

set @dt = '12/10/2003'
set @tm = '13:00'

select CAST(@dt + ' ' + @tm as datetime)


I have always found SQL Server to be most amenable to dates in this format
(YYYYMMDD)


select CAST('20030304 13:00' as datetime)



Formatting Character Data into Datetime fields
(http://www.sqldts.com/default.aspx?249)



--

----------------------------

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"jayne" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi,

I've been having this problem. I'm trying to export a
series of date and time from ms access to sql server but
can only manage to export the date but not the time as the
date and time are two separate columns. The error that I
receive after execution in sql server is that there is
an "invalid character value for cast specification".

Please help, thanks.




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.