Page 1 of 1

MS SQL 2008 (R2) new data types

Posted: Thu 19 Jul 2012 12:01
by roman.vitek
Hi, I have problems with new data types for MS SQL Server 2008 (R2):
DATE, TIME, DATETIME2

When I use UniQuery I get this:
A = DATE field
B = TIME(0) field
C = DATETIME2(0) field

UniQuery.FieldByName("A").DataType = ftWideString // correct is = ftDate
UniQuery.FieldByName("B").DataType = ftWideString // correct is = ftTime
UniQuery.FieldByName("C").DataType = ftWideString // correct is = ftDateTime

Thanks, Roman

Re: MS SQL 2008 (R2) new data types

Posted: Thu 19 Jul 2012 12:51
by AndreyZ
Hello,

This problem is caused by the OLEDB provider. OLEDB provider returns DATE, TIME, DATETIME, and DATETIME2 columns in the string format. To solve the problem, you should use the SQL Native Client provider. To use SQL Native Client, you should set the OLEDBProvider specific option to prNativeClient. Here is an example:

Code: Select all

UniConnection.SpecificOptions.Values['OLEDBProvider'] := 'prNativeClient';