I m using SQL Server 2008 R2 and have this table:
ID Phrase
1 smeels
2 like
3 teen
4 spirit
But the number of phrases is like about 20 000 and my goal is to "turn it other way" so to get the output like this:
ID Smeels Like Teen Spirit
1 1 0 0 0
2 0 1 0 0
3 0 0 1 0
4 0 0 0 1
Tried to use CASE with Pivot function but I don't know how to handle with big amount of columns. How can I deal with this task?
Thanks in advance.