Skip to the main content.
Downloads Try Thriftly
Downloads Try Thriftly
Group 762

Migrate and run DataFlex applications with Oracle, MS SQL Server, PostgreSQL, MySQL &  MariaDB.

flex2Crystal

Stuck in Crystal XI?  Upgrade and use the latest versions of Crystal Reports with DataFlex applications. 

BTR2SQL

Convert from Btrieve / P.SQL / Actian transactional engines to Oracle, MS SQL Server, and PostgreSQL

thriftly-1

Quickly build multi-protocol web services with the same API. Supports JSON-RPC, REST, SOAP,  Thrift, and gRPC.

 Group 671-1

 

Why Mertech?

1 min read

Fetching Date Values into DataFlex Date Field Using Embedded SQL

SQL Server databases have a unique date format. This is a clean way to receive date columns from a statement (stmt) directly to a DataFlex (DF) Table.Field or a Date Variable.


Get_Attribute DF_DATE_FORMAT to iDateFormat_Stmt


If (sDriver_Stmt = "MDSMYSQL") Begin
    If (iDateFormat_Stmt = DF_DATE_USA      ) Move "select code, name, date_format(date1, '%m/%d/%Y') from vi_5778 order by code" to sStmt
    If (iDateFormat_Stmt = DF_DATE_EUROPEAN) Move"select code, name, date_format(date1,'%d/%m,%Y') from vi_5778 order by code" to sStmt
    If (iDateFormat_Stmt = DF_DATE_MILITARY) Move "select code, name, date_format(date1,'%Y/%m/%d') from vi_5778 order by code" to sStmt
End

If sDriver_Stmt = "MDSPGSQL") Begin
    If (iDateFormat_Stmt = DF_DATE_USA      ) Move "select code, name,RTrim(substring(date1 from 6 for 2) || '/' || substring(date1 from 9 for 2) || '/' || substring(date1 from 1 for 4)) as date1 from vi_5778 order by code" to sStmt
    If (iDateFormat_Stmt = DF_DATE_EUROPEAN) Move "select code, name, RTrim(substring(date1 from 9 for 2) || '/' || substring(date1 from 6 for 2) || '/' || substring(date1 from1 for 4)) as date1 from vi_5778 order by code" to sStmt
    If (iDateFormat_Stmt = DF_DATE_MILITARY) Move "select code, name, RTrim(substring(date1 from 1 for 4) || '/' || substring(date1 from 6 for 2) || '/' || substring(date1 from 9 for 2)) as date1 from vi_5778 order by code" to sStmt
End

Tip:

For Flex2SQL we introduced a special command which set it automatically.
It is a Procedure Set named 'SqlUseDataflexDateFormat'


Usage:

Set SqlUseDataflexDateFormat to DFTrue/DFFalse

 

Legacy Application Modernization: Key Steps, Benefits & Best Practices

Legacy Application Modernization: Key Steps, Benefits & Best Practices

This blog post was co-authored with Riaz Merchant, President and CEO at Mertech. In the fast-paced software world, 'legacy' often signals a warning.

Read More
Hybrid Cloud Migration: Plan, Process and Advantages

Hybrid Cloud Migration: Plan, Process and Advantages

This post was co-authored with Riaz Merchant, President/CEO at Mertech Data Systems, Inc.

Read More
Financial Benefits of Cloud Migration & Hybrid Cloud Applications

Financial Benefits of Cloud Migration & Hybrid Cloud Applications

Shifting from your traditional legacy systems to the Cloud can be a game changer, as the benefits of cloud migration are numerous. Cloud computing...

Read More