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 2005 Forums
 Transact-SQL (2005)
 Problem with Year/GetDate

Author  Topic 

davidshq
Posting Yak Master

119 Posts

Posted - 2010-05-05 : 14:47:32
I'm trying to pull just the current year. I did several different variations such as below but none have worked. I know there must be a simple fix - help. :)
Year(GetDate())
SELECT YEAR(SELECT GETDATE())
Dave.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-05-05 : 14:50:13
didnt

SELECT YEAR(GETDATE())
work for you?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

davidshq
Posting Yak Master

119 Posts

Posted - 2010-05-05 : 14:50:36
yeah, it does...i don't know what i did wrong. thanks.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-05-05 : 14:59:25
ok . cool

you can also use

SELECT DATEPART(yy,GETDATE())

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -