Data Types Supported in SQL Server CE
SQL Server 2000
Data Types Supported in SQL Server CE
Microsoft® SQL Server™ 2000 Windows® CE Edition (SQL Server CE) contains a subset of data types that are upwardly compatible with SQL Server; however, there are some differences:
- Not all data types in SQL Server are supported in SQL Server CE. For example, non-Unicode text columns (varchar, char, text) and smallmoney are not supported; although nvarchar, nchar, ntext, and money are supported.
- The maximum sizes of variable-length columns differ between SQL Server and SQL Server CE. SQL Server supports variable-length nvarchar and varbinary types up to 8,000 bytes long, and SQL Server CE supports a maximum size of 510 bytes. If necessary, the appropriate larger types (ntext and image) can be used to store more data in a column. For more information, see Working with Large Data Types.
For generically exposed type information about the OLE DB Provider for SQL Server CE, see the PROVIDER_TYPES schema rowset in SQL Server CE Schema Rowsets.
The following table shows the mapping of native data types in SQL Server CE to the standard OLE DB data types, including any related properties and limitations. For a table showing the data type mapping between SQL Server CE and Microsoft ActiveX® Data Objects Extensions (ADOX), see SQL Server CE Data Type Mapping from ADOX.
| SQL Server CE data type | OLE DB data type | OLE DB properties | SQL Server CE specifics |
|---|---|---|---|
| bigint | DBTYPE_I8 | ||
| binary | DBTYPE_BYTES | DBPROP_COL_FIXEDLENGTH = VARIANT_TRUE | |
| bit | DBTYPE_BOOL | ||
| datetime | DBTYPE_DBTIMESTAMP | Valid year range 1753-9999; valid second range 0-59 | |
| float | DBTYPE_R8 | ||
| image | DBTYPE_BYTES | ||
| integer | DBTYPE_I4 | ||
| money | DBTYPE_CY | ||
| national character | DBTYPE_WSTR | DBPROP_COL_FIXEDLENGTH = VARIANT_TRUE | |
| national character varying | DBTYPE_WSTR | DBPROP_COL_FIXEDLENGTH = VARIANT_FALSE | |
| ntext | DBTYPE_WSTR | ||
| numeric | DBTYPE_NUMERIC | ||
| real | DBTYPE_R4 | ||
| smallint | DBTYPE_I2 | ||
| uniqueidentifier | DBTYPE_GUID | ||
| tinyint | DBTYPE_UI1 | ||
| varbinary | DBTYPE_BYTES | DBPROP_COL_FIXEDLENGTH = VARIANT_FALSE |