dbTalk Databases Forums  

Date conversion error

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


Discuss Date conversion error in the microsoft.public.sqlserver.dts forum.



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

Default Date conversion error - 07-12-2004 , 05:44 AM






I am transforming a date from text to smalldatetime,
however when I come across dates with years way in the
future, such as 3001, the transformation falls over with
this message

syntax error converting character string to smalldatetime
data type

I have tried using the advanced tab to throw out all rows
with dodgy dates into a text file but the task still falls
over.

Does anyone have any ideas of how I can get SQLServer to
accept these dates or how I can get them reported as an
exception and the rest of the job to run correctly?

Many thanks, Lynne

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

Default Re: Date conversion error - 07-12-2004 , 09:51 AM






What is the Source?

If the source is capable then you could filter the Source rows by
placing a WHERE clause on the SourceSQLStatement

If the source is a text file then you can import to a staging SQL
Server table and maipulate from there.

SmallDateTime obviously only accepts dates up until and including the
year 2079. If these dates in your source are valid and expected then
the designer of the database has incorrectly constrained this attribute
to a smalldatetime when it should have been a datetime.




Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
www.konesans.com - for all your consultancy needs




Reply With Quote
  #3  
Old   
 
Posts: n/a

Default Re: Date conversion error - 07-12-2004 , 12:41 PM



Thanks for this. I am quite a novice and didn't realise
that dates only went up to 2079 using smalldatetime. It
is now working.

Thank you, Lynne
Quote:
-----Original Message-----
What is the Source?

If the source is capable then you could filter the Source
rows by
placing a WHERE clause on the SourceSQLStatement

If the source is a text file then you can import to a
staging SQL
Server table and maipulate from there.

SmallDateTime obviously only accepts dates up until and
including the
year 2079. If these dates in your source are valid and
expected then
the designer of the database has incorrectly constrained
this attribute
to a smalldatetime when it should have been a datetime.




Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
www.konesans.com - for all your consultancy needs



.


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.