Syntax rules vary between the ODBC drivers for the different database applications. If you need help with syntax, contact your database administrator.
The syntax for database applications other than Access might be different.
For best results, do not copy and paste these expressions from the table. Type them directly in the dialog box.
Data to import | SQL expression |
---|---|
Records for the first quarter of 2017 |
|
Records for employees hired since January 1, 2010 who are in the Finance department |
|
Data from the past 30 days |
|
Yesterday's data |
|
SQL has ODBC functions that you can use to build expressions. However, a specific ODBC driver might not support all ODBC functions. For example, the Microsoft® Access ODBC driver does not support the TIMESTAMPDIFF function. If you receive an error message, the message originates from the ODBC driver, not from Minitab.
"SQL Error State: 37000, Native Error Code: FFFFF3E2, ODBC Error: [Microsoft] [ODBC Microsoft® Access Driver] Undefined function 'TIMESTAMPDIFF' in expression."
Access supplies an alternative function for TIMESTAMPDIFF. The alternative function is DATEDIFF( ). The following query retrieves three columns from an employee record. The first column is the elapsed number of days from the employee's start date through today. The second and third columns are the employee's name and start date.
ODBC;
Connect "DSN=Test;DBQ=Q:\Trumparc.mdb;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;PWD=msl;SystemDB=Q:\secured.mdw;UID=msl;";
SQLString "SELECT DateDiff('y', `StartDate`, Now()),`Name`,`StartDate` FROM `Employee`".