Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 SQL SELECT with Month of Current Date

Author  Topic 

Mandla
Starting Member

2 Posts

Posted - 2004-06-24 : 12:04:49
I am trying to construct a SQL statement that will follow the following logic. The DB is Access 2002, WebServer .Net 1.1 and Dreamweaver MX 2004 as Dev Tool.

SELECT all records
FROM Query in DB
WHERE office = defined parameter AND MONTH(Anniversary) = month of current date

I have tried without any luck (the following is not the complete command text):

SELECT * FROM Query1 WHERE Query1.office = ? AND MONTH(anniversary) = ?

PARAMETERS: <parameter Name="@office" Value='<%# "melbourne" %>' Type="WChar" />
<parameter Name="@anniversary" Value='<%# "getdate()" %>' Type="WChar" />

Any ideas or suggestions?

Many thanks in advance.

"All men recognize the right of revolution; that is, the right to refuse allegiance to, and to resist, the government, when its tyranny or its inefficiency are great and unendurable." Thoreau

drymchaser
Aged Yak Warrior

552 Posts

Posted - 2004-06-24 : 12:11:31
getdate() isn't valid in Access 2000 not sure about 2002 but typically is a TSQL function.

"Month(Date())" will probably work.
Go to Top of Page

Mandla
Starting Member

2 Posts

Posted - 2004-06-24 : 13:15:24
That cooks with Gas! Thanks.

Mandla.

"All men recognize the right of revolution; that is, the right to refuse allegiance to, and to resist, the government, when its tyranny or its inefficiency are great and unendurable." Thoreau
Go to Top of Page
   

- Advertisement -