This is just a quick guess, but I would think you want DATEPART(m, work_day)
rather than having the m in quotes.  That's just first look at it based on
SQL books online.

> -----Original Message-----
> From: Bruce, Rodney S HQISEC/Veridian IT Services
> [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, July 22, 2003 3:10 PM
> To: CF-Talk
> Subject: SQL help
>
>
> Hi all
>
> We are finally tring to upgrate from Access to SQL 2000.
>
> I am working on making the necessary changes to the queries.
>
> One I am having a problem with is were the WHERE statement is:
>
> WHERE (proj_name = '#Qgetinfo.proj_name# ')
> and(datepart('M',work_day) =#m#)
>
> m=number for the month:  m=5.
> work_day is the field in the db table.
>
> this works fine with Access(data type  date/time), but with SQL I get the
> error:
>
> Error Diagnostic Information
> ODBC Error Code = 37000 (Syntax error or access violation)
>
> [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid parameter
> 1 specified
> for datepart
>
>
> when the data type is smalldatetime and if I change it to timestamp,  no
> error but no records are returned either.
>
> This is used to create a report based on the project selected and
> the month.
>
> THanks
> Rodney
>
>
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to