I like the new DATE data type in SQL Server 2008, but when I compare the DATE field with the DATETIME field on the linked server (in this case, SQL 2005), for example:
DECLARE @MyDate DATE SET @MyDate = CONVERT(DATE, GETDATE()) SELECT * FROM MySQL2005LinkedServer.SomeDB.dbo.SomeTable WHERE SomeDatetimeField < @MyDate
I get this error:
OLE DB provider "SQLNCLI10" returned message "Unspecified error". OLE DB provider "SQLNCLI10" returned message "The scale is invalid.".
The "scale is invalid", obviously, because the Native client passes the DATatype back to the linked server, and since it is SQL 2005, it does not know what to do with it. Fulfilling the same query with the 2008 server works very well - SQL Server can easily compare DATE and DATETIME data types.
Here my question is - is there a reason why the root client does not automatically convert the DATE value '2009-11-09' to DATETIME from '2009-11-09 00: 00: 00.000' so that the previous version of SQL Server does not strangle it?
source share