Skip to content
Advertisement

Tag: ssms

Bring a row for each specific column that is not empty, with the column name

I’ve this table with the following data: ID Data1 Data2 Data3 Data4 Data5 Data6 RandomInformation 1 Test1 Test2 Test3 Information1 2 Test5 Test6 Test7 Information2 3 Test8 Test9 Test10 Test11 Information3 The resultant table i want should be as below: ID Data RandomInformation 1 Data1 Information1 1 Data3 Information1 1 Data5 Information1 2 Data2 Information2 2 Data4 Information2 2 Data6

SQL Server syntax correction [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 9 months ago. Improve this question I am trying to create a SQL Server stored procedure but I am getting some errors. Here are the errors: Msg 102,

Include Column name in SQL Unpivot

I have an unnormalized data set I need to normalize for reporting purposes. I successfully unpivoted the data using this: How can unpivot column headers Question1, Question2, Question3, Question4 as a third column in my unpivot query, like this? Answer Your syntax looks like SQL Server. If so, just use a APPLY:

Advertisement