none
Addint auto increment column to exisitng table RRS feed

  • Question

  • i have a table with

    CreateDate datetime

    ClientID int

    AccountId int

    i want :

    1. to add an ID column that the id will be added to each row based on the CreateDate time stasmp(if there are 2 rows with time stamp dosen't matter the order between them).

    2. after update the ID colummn, to change it to IDENTITY colum with AUTO INCREMENT .

    example

    before

    2019-11-20 15:57:29.390,4,6
    
    2019-11-20 15:58:19.390,6,8
    
    2019-11-20 15:58:19.390,7,1

    after

    2019-11-20 15:57:29.390,4,6,1
    
    2019-11-20 15:58:19.390,6,8,2
    
    2019-11-20 15:58:19.390,7,1,3

    Thanks!

    Wednesday, November 20, 2019 4:44 PM

All replies