Adding two column based on existing column in sql server.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phanikumar32
    New Member
    • Apr 2014
    • 22

    Adding two column based on existing column in sql server.

    Hello all,

    I have a table in my sql server with column name as'type' and 'Direction'
    (as shown in image 1).

    and from this input i want the output as below once.
    (as shown in image 2).

    Thanks In Advance,
    Phani Kumar.
    Attached Files
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    That's impossible to do without some sort of unique sequential ID because there is no guarantee that a select query returns rows in the original insert order.

    Comment

    • phanikumar32
      New Member
      • Apr 2014
      • 22

      #3
      Thanks Rabbit,

      If at least we can add any one of the column(that is either caller Id or Sequence Id).
      If possible please tell me how i add that column in the output result set.Even though the select statements returns rows in original order.

      Thanks In Advance,
      Phani Kumar.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        Like I already said, it's impossible to do unless you have an existing unique, sequential ID.

        The best you can hope for is to reinsert into a table with an auto-generated key and hope that the order is correct.

        Comment

        Working...