Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return last 2 digits of the Year ??

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How can I return the last 2 digits of the year into a variable?

SELECT DATEPART(yy, GETDATE()) ---> returns 2001 ... I only want 01 returned.

Thx,
BT
 
Hi,

select substring(convert(varchar,getdate(),101),9,2)
or

select substring(convert(varchar,datepart(year,getdate())),3,2)

xcata.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top