Concatonating year using date parameter with extract function

70 pts.
Tags:
SQL Server Query

I have a date parameter :ASOFDATE being entered as such: 01/01/2008.

I would like the following to print out in my columns: 2008-09.

The code I am using to attempt getting this is as follows: to_char(extract(year FROM to_date(:ASOFDATE, 'DD-MM-YYYY'))) || '-' || substr(extract(year FROM to_date(:ASOFDATE , 'DD-MM-YYYY') + 365), 3,2) The information that prints in my column is 8 –

Can you please show me the correct way to write the code so that I can get the desired result of 2008-09? Thank you



Software/Hardware used:
Microsoft Visual Studio 9.0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following