1

I'm currently looking for a dynamic way to convert rows to columns in a specific way in SQL server (I was able to do it in excel vba but the excel limitations made me go to SQL).

Abstract : I am making a daily analysis over 10 years considering 1315 stocks, for each stock we have daily returns for a period going from 29/12/2009 to 30/12/2016.

As you can see every 2614 row there's a new stock with the 3 following rows showing text..

Table on SQL

And I would like to obtain this result.. therefore looking for a good insight to help me go through this!

Desired solution draft

I am doing this for a quantitative department in Luxembourg to implement a dynamic model allocation of smart betas. (First time with SQL)

Thank you for your help! feel free to ask any questions if you need any other detail..

R.H.

Robin_Hcp
  • 309
  • 2
  • 15

1 Answers1

0

This is also known as a dynamic pivot -- for sql server see https://stackoverflow.com/a/10404455/1327961

Community
  • 1
  • 1
user1327961
  • 452
  • 2
  • 8