dbTalk Databases Forums  

Invalid value for Cast Specification

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


Discuss Invalid value for Cast Specification in the microsoft.public.sqlserver.dts forum.



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

Default Invalid value for Cast Specification - 04-15-2006 , 12:54 PM






I am importing data from Access to SQL Server. There were two DateTime
fields in Access. One contained a date, the other a time created by the
TimeSerial serial function. The date imports correctly and the Time field
gets the error below. The field created on SQL Server is SMALLDATETIME for
both. Does the time value need to be casted and if so how is that done on
the DTS Transformations tab ?


Error Source: Microsoft OLE DB Provider for SQL Server
Error Description:Invalid character value for cast specification.
Error Help File:
Error Help Context ID:0
1 2 |12|R B S B o s t o n |2 2 0 1 |R |S E G 1 |W F 0 5 0 9 0 7 9 9
Quote:
1|5/10/2005|8:00:00 AM|5/10/2005|8:22:00 AM|0|0|0.37|A F 2 0 0 |A 7 2 2 7 0
6 0 4 1 4 |
1 2 |12|R B S B o s t o n |2 2 0 1 |R |S E G 1 |W F 0 5 0 9 0 7 9 9
Quote:
1|5/10/2005|8:00:00 AM|5/10/2005|8:22:00 AM|0|0|0.37|A F 2 0 0 |A 7 2 2 7 0
6 0 4 1 4 |



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

Default Re: Invalid value for Cast Specification - 04-15-2006 , 01:22 PM






Hello rmcompute,


This is because the date generated will be

1899-12-30 08:22:00.000

and this is outside of the ranges for a SMALLDATETIME datatype. It will
work with a DATETIME datatype.


This said. Do you not want to join the date and the time back together as
SQL Server has no concept of one without the other?


Here is some activeX trasnform script that will allow you to put your time
into the datetime column

DTSDestination("Name OF Your Destination Column") = CDATE( "1/1/1900 "
& DTSSource("Name Of Your Source Column"))




Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

Quote:
I am importing data from Access to SQL Server. There were two
DateTime fields in Access. One contained a date, the other a time
created by the TimeSerial serial function. The date imports correctly
and the Time field gets the error below. The field created on SQL
Server is SMALLDATETIME for both. Does the time value need to be
casted and if so how is that done on the DTS Transformations tab ?

Error Source: Microsoft OLE DB Provider for SQL Server
Error Description:Invalid character value for cast specification.
Error Help File:
Error Help Context ID:0
1 2 |12|R B S B o s t o n |2 2 0 1 |R |S E G 1 |W F 0 5 0 9 0 7
9 9
|1|5/10/2005|8:00:00 AM|5/10/2005|8:22:00 AM|0|0|0.37|A F 2 0 0 |A 7 2
2 7 0
6 0 4 1 4 |
1 2 |12|R B S B o s t o n |2 2 0 1 |R |S E G 1 |W F 0 5 0 9 0 7 9
9
|1|5/10/2005|8:00:00 AM|5/10/2005|8:22:00 AM|0|0|0.37|A F 2 0 0 |A 7 2
2 7 0
6 0 4 1 4 |



Reply With Quote
  #3  
Old   
rmcompute
 
Posts: n/a

Default Re: Invalid value for Cast Specification - 04-15-2006 , 05:23 PM



Worked like a charm. Thanks for the help.

"Allan Mitchell" wrote:

Quote:
Hello rmcompute,


This is because the date generated will be

1899-12-30 08:22:00.000

and this is outside of the ranges for a SMALLDATETIME datatype. It will
work with a DATETIME datatype.


This said. Do you not want to join the date and the time back together as
SQL Server has no concept of one without the other?


Here is some activeX trasnform script that will allow you to put your time
into the datetime column

DTSDestination("Name OF Your Destination Column") = CDATE( "1/1/1900 "
& DTSSource("Name Of Your Source Column"))




Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

I am importing data from Access to SQL Server. There were two
DateTime fields in Access. One contained a date, the other a time
created by the TimeSerial serial function. The date imports correctly
and the Time field gets the error below. The field created on SQL
Server is SMALLDATETIME for both. Does the time value need to be
casted and if so how is that done on the DTS Transformations tab ?

Error Source: Microsoft OLE DB Provider for SQL Server
Error Description:Invalid character value for cast specification.
Error Help File:
Error Help Context ID:0
1 2 |12|R B S B o s t o n |2 2 0 1 |R |S E G 1 |W F 0 5 0 9 0 7
9 9
|1|5/10/2005|8:00:00 AM|5/10/2005|8:22:00 AM|0|0|0.37|A F 2 0 0 |A 7 2
2 7 0
6 0 4 1 4 |
1 2 |12|R B S B o s t o n |2 2 0 1 |R |S E G 1 |W F 0 5 0 9 0 7 9
9
|1|5/10/2005|8:00:00 AM|5/10/2005|8:22:00 AM|0|0|0.37|A F 2 0 0 |A 7 2
2 7 0
6 0 4 1 4 |




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.