Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2002
    Nottingham - UK

    Unanswered: smalldatetime query

    Hi Folks

    Im using SQL 2000.

    Is it possible to have a query that does the following....

    select * where myDate = current year

    I am wanting to display results purely from the current year automatically.

    Any pointers will be great.

    Thanks all

  2. #2
    Join Date
    Dec 2005
    Hello donaldt

    As I understood, you would like to query the data based on year.
    Since Northwind database comes with all the copies of SQL server 2000, I will use that database to do this query.

    USE Northwind

    SELECT * FROM Employees WHERE YEAR(HireDate) = '1993'


    I hope this answer helped you on your project. If you have problems understanding something, I will be glad to assist you.

    All the best,

  3. #3
    Join Date
    Dec 2003
    select * from table_name where year(myDate) = year(getdate())
    -- or
    select * from table_name where datediff(year,myDate,getdate())=0
    Link Link

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts