Skip to content
Advertisement

sql server single row multiple columns into one column

I have table like this

From this I need to create a temp table or table like this:

Is there a way I can do this in SQL Server?

Advertisement

Answer

Check this Fiddle

If you do want NULL values in the rest, you may try the following:

This is the new Fiddle

And here is the code:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement