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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 month and year

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-11 : 09:43:32
daniela writes "Hi,
I'm moving from Access to SqlServer and I need to make some modification to my Visual Basic code.
I need to know if the following query is still valid for SqlServer:

SELECT * FROM myTable
WHERE Month(myDate)=5 AND Year(myDate)=2001

Thank you very much!
Daniela"

JustinBigelow
SQL Gigolo

1157 Posts

Posted - 2001-12-11 : 09:53:55
You will need to replace the Month() and Year() functions with the datepart() function in sqlserver.

datepart(m, mydate)=5
datepart(yy, mydate)=2001

see Books On Line for more info on the datepart function.

hth,
Justin

Go to Top of Page

mfemenel
Professor Frink

1421 Posts

Posted - 2001-12-11 : 10:43:30
Actually, Month and Year are still valid functions in SQL 7. I'm not sure about 2K

Mike
"A program is a device used to convert data into error messages."
Go to Top of Page
   

- Advertisement -