SUPPORT / SAMPLES & SAS NOTES
 

Support

Problem Note 17331: "ERROR: Invalid Character Value for Cast Specification" with SAS/ACCESS Interface to OLE DB and SQL Server 2005

DetailsHotfixAboutRate It

In SQL Server, a data type of datetime stores date and time data from January 1, 1753, through December 31, 9999, with an accuracy of 3.33 milliseconds. A data type of smalldatetime stores date and time data from January 1, 1900, through June 6, 2079, with an accuracy of one minute. The columns with smalldatetime data type use only four bytes to store their values, in comparison with eight bytes used to store the columns with datetime data types.

When a datetime value is exported to SQL Server 2005 Enterprise edition, the data type being chosen is smalldatetime instead of datetime. This could cause errors if the year portion of the datetime value is greater than 2079. This problem doesn't occur if the datetime value is exported to SQL Server 2000 Enterprise Edition.

One workaround may be to use the DBTYPE= data set option. For example:

LIBNAME olelib oledb init_string="Provider=SQLOLEDB.1;Password=pass; Persist Security Info=True;User ID=jen;Initial Catalog=users; Data Source=sqlsrv01"; data olelib.AWD (dbtype=(date='datetime')); set sasdata.AWD; run;

Select the Hot Fix tab in this note to access the hot fix for this issue.



Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemSAS/ACCESS Interface to OLE DBMicrosoft Windows Server 2003 Datacenter Edition9.1 TS1M39.2 TS1M0
Microsoft Windows Server 2003 Enterprise Edition9.1 TS1M39.2 TS1M0
Microsoft Windows Server 2003 Standard Edition9.1 TS1M39.2 TS1M0
Microsoft® Windows® for 64-Bit Itanium-based Systems9.1 TS1M39.2 TS1M0
Microsoft Windows XP 64-bit Edition9.1 TS1M39.2 TS1M0
Microsoft Windows XP Professional9.1 TS1M39.2 TS1M0
Microsoft Windows 2000 Professional9.1 TS1M39.2 TS1M0
Microsoft Windows 2000 Server9.1 TS1M39.2 TS1M0
Microsoft Windows 2000 Advanced Server9.1 TS1M39.2 TS1M0
Microsoft Windows 2000 Datacenter Server9.1 TS1M39.2 TS1M0
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.