Use

WHERE MONTH(maint_report_date) = <cfqueryparam
cfsqltype="cf_sql_integer" value="#Month(Now())#">

> -----Original Message-----
> From: Robert Orlini [mailto:[EMAIL PROTECTED]
> Sent: vrijdag 16 april 2004 14:47
> To: CF-Talk
> Subject: RE: Query date
>
> Thanks Jochem. I still get an error. See below:
>  
> Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect
> syntax near the keyword 'FROM'.
>
>
> SQL = "SELECT * FROM maintenance_report WHERE EXTRACT(MONTH
> FROM maint_report_date) = ? ORDER BY id DESC"
>
>
> Query Parameter Value(s) -
>
>
> Parameter #1 = 4
>
> Maybe I copied something wrong?
>
> Robert O.
>
>  
>
> -----Original Message-----
> From: Jochem van Dieten [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 15, 2004 4:11 PM
> To: CF-Talk
> Subject: Re: Query date
>
>
> Robert Orlini wrote:
> > I'm doing a comparison of the current date with the date in a table:
> >
> > <cfquery name="report" datasource="wweb_status_internal">
> > <!--- Select top 1 * lists first record---> Select * From
> > maintenance_report Where id = id and
> "#left(maint_report_date,2)#" =
> > "#dateFormat(Now(), "MM")#"
> > Order by id desc
> > </cfquery>
> >
> > I'm isolating the first two chars of the date (i.e.
> 04/05/2004) lets say "04" and comparing to the month value in
> the where statement.
> >
> > I'm getting an: "Cannot use empty object or column names.
> Use a single space if necessary" error.
>
> That is because you are using double quotes instead of single
> quotes, it already fails in the parser stage.
>
> > I know my Where comparison on the date is wrong. Any ideas please?
>
> <cfquery name="report" datasource="wweb_status_internal">
>    SELECT *
>    FROM maintenance_report
>    WHERE EXTRACT(MONTH FROM maint_report_date) =
> <cfqueryparam cfsqltype="cf_sql_integer" value="#Month(Now())#">
>    ORDER BY id DESC
> </cfquery>
>
> Jochem
>
> --
> I don't get it
> immigrants don't work
> and steal our jobs
>      - Loesje
>   _____  
>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to