Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Data type problem with ODBC

Author  Topic 

notalian
Starting Member

8 Posts

Posted - 2007-03-08 : 19:51:02
I am new to SQL so I maybe missing something easy and obvious.
I have a data type problem that can be solved in two ways and I need help with either of the two.

Problem:
I am importing data from a third part ODBC driver (Open Systems OSAS ODBC Driver). In one of the history files, some of the transaction dates are incorcect; theu show 3003 and 5005 etc. During import, SQL stops at these dates and throws an error.

The only way I could import this data was to change the data type from smalldatetime to varchar so now the data is in SQL but it's in 2007-02-20 format.

Option 1:
Is there a way to tell SQL not to worry about these too far into future dates and import them?

Option 2:
Once this data is in SQL as varchar, is there a query that could change it in smalldatetime format?

Notalin

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-08 : 20:45:56
Option 3:
change from smalldatetime to datetime.

quote:
datetime and smalldatetime
Date and time data types for representing date and time of day.

datetime

Date and time data from January 1, 1753 through December 31, 9999, to an accuracy of one three-hundredth of a second (equivalent to 3.33 milliseconds or 0.00333 seconds). Values are rounded to increments of .000, .003, or .007 seconds, as shown in the table.

smalldatetime

Date and time data from January 1, 1900, through June 6, 2079, with accuracy to the minute. smalldatetime values with 29.998 seconds or lower are rounded down to the nearest minute; values with 29.999 seconds or higher are rounded up to the nearest minute.




KH

Go to Top of Page

notalian
Starting Member

8 Posts

Posted - 2007-03-08 : 23:11:57
Thanks a lot khtan. Regards.

Notalin
Go to Top of Page
   

- Advertisement -