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 2008 Forums
 Transact-SQL (2008)
 Get abbrev year out of current date

Author  Topic 

qman
Constraint Violating Yak Guru

442 Posts

Posted - 2011-09-21 : 11:39:26
How can I retreive just 11 out of the current date?

select DATEPART ( yy , getDate() )

Thanks!

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2011-09-21 : 11:43:26
Maybe this will help:
SELECT 
RIGHT(CAST(YEAR(CURRENT_TIMESTAMP) AS VARCHAR(4)), 2),
RIGHT(YEAR(CURRENT_TIMESTAMP), 2)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-21 : 11:46:06
select DATEPART ( yy , getDate() )%100

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

Go to Top of Page

qman
Constraint Violating Yak Guru

442 Posts

Posted - 2011-09-21 : 11:46:09
Perfect, thanks!
Go to Top of Page
   

- Advertisement -