Select from following answers:- SELECT YEAR(GETDATE())
- SELECT DATEPART(Y, GETDATE())
- SELECT LEFT(CONVERT(VARCHAR(10), GETDATE(), 111), 4)
- SELECT CONVERT(VARCHAR(4), GETDATE(), 120)
- All Above
SELECT DATEPART(Y, GETDATE()) because passing a value of "Y" to the DATEPART date function will return the day of the year for the given date.
Remaining all of the options return year part of current date
Show Correct Answer
Asked In: Many Interviews |
Alert Moderator