Display Years
Hi, how can i display current year to next 15 years by using sql.
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Dipankar BiswasRank #992 · 2K reputationPosted Aug 11, 2014, 11:23 PM EDT
SELECT datepart(yyyy, getdate())Sarath KumarRank #3,637 · 402 reputationPosted Aug 11, 2014, 11:32 PM EDT
for example, i need to display 2014 to 2030
Ankur JainRank #2,475 · 567 reputationPosted Aug 12, 2014, 12:07 AM EDT
Sorry,I didn't get your question properly but here is the query to get next year or how many of year next to current year you want to get, you just add number in query then you will get the next year ..
select CONVERT(datetime, CONVERT(VARCHAR(20), YEAR(GETDATE())+15) + '.01.01')
Sarath KumarRank #3,637 · 402 reputationPosted Aug 12, 2014, 1:15 AM EDT
now you can understand