How to retrieve 'native' SQL Server data type

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 56
Joined: Mon 26 Mar 2007 01:25

How to retrieve 'native' SQL Server data type

Post by yeohray » Sun 06 May 2007 16:19

In a result set returned by TMSQuery, is it possible to find out the 'native' data type for each column? E.g. a TStringField could be from a CHAR or VARCHAR type, similarly a TWideStringField could be from NCHAR or NVARCHAR type.


Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Mon 07 May 2007 13:08

SDAC doesn't allow you to get native data type of the field.
But you can determine it from the properties of the TField class and its descendants.
For example, for a column with the char(10) type, a field of the TStringField class with the property FixedChar equal to True and the Size property equal to 10 will be created. For the column with the varchar(10) type will be created the same object, but the FixedChar property will equal to False, and so on.

Post Reply