Skip to main content
edited tags
Link
Taryn
  • 248.8k
  • 57
  • 374
  • 409
edited tags
Link
Lamak
  • 70.8k
  • 12
  • 118
  • 119

SQL Server covertconvert columns to rows

I have a sql table with current value and previous value.

Id  Value1  PValue1 Value2  PValue2
1   A       A       V       V1
2   B       B1      W       W1
3   C       C1      X       X

I would likewant to compare them and display in a the following table if the value has been changes.

Id  Column  Value   Pvalue
1   Value2  V       V1
2   Value1  B       B1
2   Value2  W       W1
3   Value1  C       C1

Is it possible in SQL 2008 without looping each column?

SQL Server covert columns to rows

I have a sql table with current value and previous value.

Id  Value1  PValue1 Value2  PValue2
1   A       A       V       V1
2   B       B1      W       W1
3   C       C1      X       X

I would like to compare them and display in a the following table if the value has been changes.

Id  Column  Value   Pvalue
1   Value2  V       V1
2   Value1  B       B1
2   Value2  W       W1
3   Value1  C       C1

Is it possible in SQL 2008 without looping each column?

SQL Server convert columns to rows

I have a sql table with current value and previous value.

Id  Value1  PValue1 Value2  PValue2
1   A       A       V       V1
2   B       B1      W       W1
3   C       C1      X       X

I want to compare them and display in a the following table if the value has changes.

Id  Column  Value   Pvalue
1   Value2  V       V1
2   Value1  B       B1
2   Value2  W       W1
3   Value1  C       C1

Is it possible in SQL 2008 without looping each column?

Source Link
developer
  • 1.6k
  • 5
  • 40
  • 89
Loading