Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How to add numeric Identity (primary key) column in reverse order of an existing unique numeric column?

$
0
0

I need to add a numeric Identity primary key column (IDcol) to a table which already has an existing numeric column (numCol) which is unique -- but I want to add the Identity column to list in reverse order of the existing numeric column.

Right now when I add the Identity column -- it lists as follows.

IDcol    numCol
  1          0
  2          1
  3          2
...       ...
  101      100

I need it to list like this:


IDcol     numCol
  1          100
  2           99
  3           98
...         ...
  101        0

How to do this?


Rich P


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>