Board index » delphi » Getting month from date in msaccess query

Getting month from date in msaccess query

I am using D5 Prof. on msaccess 97 table. In my SQL select statement
I am trying to pull the MONTH from a date field as a new column. I tried
the EXTRACT but it refused to work as shown in localsql help.
What can i use for access tables.
Should i be using access sql syntax in my program?
 

Re:Getting month from date in msaccess query


On Fri, 03 Mar 2000 09:50:07 -0500, Peter McIntyre <disw...@home.com>
wrote:

Quote
>I am using D5 Prof. on msaccess 97 table. In my SQL select statement
>I am trying to pull the MONTH from a date field as a new column. I tried
>the EXTRACT but it refused to work as shown in localsql help.
>What can i use for access tables.
>Should i be using access sql syntax in my program?

The local SQL online help applies to dBASE, FoxPro, and Paradox
databases. Microsoft Access uses quite a bit of nonstandard SQL syntax
and so the local SQL help will often not help.

Local SQL is based on and is a subset of SQL-92. In the case of the
operation you ask about, local SQL follows the SQL standard and the
EXTRACT function is what you would use. But apparently this is another
area where Access is at odds with the standards the rest of the SQL
industry uses. What do the Access docs say about this operation?
Perhaps information on this proprietary syntax is at the Microsoft Web
site?

===========================================================
Steve Koterski
Technical Publications
Borland

Re:Getting month from date in msaccess query


Quote
>Peter McIntyre wrote:

> I am using D5 Prof. on msaccess 97 table. In my SQL select statement
> I am trying to pull the MONTH from a date field as a new column. I  > tried the EXTRACT but it refused to work as shown in localsql help.
> What can i use for access tables.
> Should i be using access sql syntax in my program?

You probably should as EXTRACT is not part of the Access SQL syntax.
The syntax for extracting parts of a date is depending on the language
of your Access copy (how ridiculous!), but you should find what you need
in the online help under a keyword like 'extracting values'.
[BTW, talking Access97 here]
________
Andreas

Other Threads