When Dexterity was first implemented on SQL Server for version 3.15, there was a number of decisions made on how to map the datatypes, fields and tables designed for ISAM platforms such as Ctree and Btrieve/Pervasive SQL to work on SQL Server.
One of the decisions was how to map the individual date and time control types to work with the datetime datatype in SQL Server.
The purpose of this article is to create a quick reference to find how to write a SQL datetime into a Dexterity table which is expecting a date or time, but not a datetime.
For a Dexterity date field to be stored in a SQL datetime column, it is stored in the date part with the time part set to midnight or ’00:00:00′. Below is the Transact-SQL commands to cast a SQL datetime to a Dexterity date:
SELECT CONVERT(DATETIME, CONVERT(VARCHAR(10), GETDATE(), 112)) AS [DATE]
For a Dexterity time field to be stored in a SQL datetime column, it is stored in the time part with the date part set to ‘1900-01-01’. Below is the Transact-SQL commands to cast a SQL datetime to a Dexterity time:
SELECT CONVERT(DATETIME, CONVERT(VARCHAR(8), GETDATE(), 108)) AS [TIME]
Hope this information is useful.
This article was originally posted on http://www.winthropdc.com/blog.