ODBC and DatePart

  • Thread starter Thread starter myname
  • Start date Start date
M

myname

Hello,

I linked Access to an Ingres II database through ODBC.

I'm trying to execute :

SELECT DatePart("yyyy",abs.dthdebabs) as Year, Count(cdtya) as Nbr
FROM abs
GROUP BY DatePart("yyyy",abs.dthdebabs);

But it fails everytime telling me :

"Column 'dthde,abs' not found in any specified table (#2102)"
(the name of the column IS misspelled)

When I remove the GROUP BY and the COUNT, if works just fine.

I don't get it... what am I doing wrong ?

Thanks !
 
Your syntax for datepart is wrong. Syntax:

DatePart(interval, date[,firstdayofweek[, firstweekofyear]])

To get more info on the syntax check the help in Access on datepart.
 
I must be exhausted : I can't see what's wrong with my syntax,
especially since it works fine without COUNT and GROUP BY.


kabaka said:
Your syntax for datepart is wrong. Syntax:

DatePart(interval, date[,firstdayofweek[, firstweekofyear]])

To get more info on the syntax check the help in Access on datepart.



myname said:
Hello,

I linked Access to an Ingres II database through ODBC.

I'm trying to execute :

SELECT DatePart("yyyy",abs.dthdebabs) as Year, Count(cdtya) as Nbr
FROM abs
GROUP BY DatePart("yyyy",abs.dthdebabs);

But it fails everytime telling me :

"Column 'dthde,abs' not found in any specified table (#2102)"
(the name of the column IS misspelled)

When I remove the GROUP BY and the COUNT, if works just fine.

I don't get it... what am I doing wrong ?

Thanks !
 
Sorry, I just read your post too quickly. Your Datepart seems ok.

You could also try to use [TableName]![FieldName] syntax for your field
reference.

Also, "Year" is a bad way to name your field as it is a function call also.
I'd change it to Field_Year or something like that.



myname said:
I must be exhausted : I can't see what's wrong with my syntax,
especially since it works fine without COUNT and GROUP BY.


kabaka said:
Your syntax for datepart is wrong. Syntax:

DatePart(interval, date[,firstdayofweek[, firstweekofyear]])

To get more info on the syntax check the help in Access on datepart.



myname said:
Hello,

I linked Access to an Ingres II database through ODBC.

I'm trying to execute :

SELECT DatePart("yyyy",abs.dthdebabs) as Year, Count(cdtya) as Nbr
FROM abs
GROUP BY DatePart("yyyy",abs.dthdebabs);

But it fails everytime telling me :

"Column 'dthde,abs' not found in any specified table (#2102)"
(the name of the column IS misspelled)

When I remove the GROUP BY and the COUNT, if works just fine.

I don't get it... what am I doing wrong ?

Thanks !
 
You definitely want to use the brackets - but make it
[TableName].[FieldName].

kabaka said:
Sorry, I just read your post too quickly. Your Datepart seems ok.

You could also try to use [TableName]![FieldName] syntax for your field
reference.

Also, "Year" is a bad way to name your field as it is a function call also.
I'd change it to Field_Year or something like that.



myname said:
I must be exhausted : I can't see what's wrong with my syntax,
especially since it works fine without COUNT and GROUP BY.


kabaka said:
Your syntax for datepart is wrong. Syntax:

DatePart(interval, date[,firstdayofweek[, firstweekofyear]])

To get more info on the syntax check the help in Access on datepart.



:

Hello,

I linked Access to an Ingres II database through ODBC.

I'm trying to execute :

SELECT DatePart("yyyy",abs.dthdebabs) as Year, Count(cdtya) as Nbr
FROM abs
GROUP BY DatePart("yyyy",abs.dthdebabs);

But it fails everytime telling me :

"Column 'dthde,abs' not found in any specified table (#2102)"
(the name of the column IS misspelled)

When I remove the GROUP BY and the COUNT, if works just fine.

I don't get it... what am I doing wrong ?

Thanks !
 
It still does not work...

Ron Hinds said:
You definitely want to use the brackets - but make it
[TableName].[FieldName].

kabaka said:
Sorry, I just read your post too quickly. Your Datepart seems ok.

You could also try to use [TableName]![FieldName] syntax for your field
reference.

Also, "Year" is a bad way to name your field as it is a function call also.
I'd change it to Field_Year or something like that.



myname said:
I must be exhausted : I can't see what's wrong with my syntax,
especially since it works fine without COUNT and GROUP BY.


"kabaka" <[email protected]> a écrit dans le message de
Your syntax for datepart is wrong. Syntax:

DatePart(interval, date[,firstdayofweek[, firstweekofyear]])

To get more info on the syntax check the help in Access on datepart.



:

Hello,

I linked Access to an Ingres II database through ODBC.

I'm trying to execute :

SELECT DatePart("yyyy",abs.dthdebabs) as Year, Count(cdtya) as Nbr
FROM abs
GROUP BY DatePart("yyyy",abs.dthdebabs);

But it fails everytime telling me :

"Column 'dthde,abs' not found in any specified table (#2102)"
(the name of the column IS misspelled)

When I remove the GROUP BY and the COUNT, if works just fine.

I don't get it... what am I doing wrong ?

Thanks !
 
Back
Top