SQL Best Practices - Ok to rely on auto increment field to sort rows chronologically?

后端 未结 7 1404
面向向阳花
面向向阳花 2021-01-01 18:52

I\'m working with a client who wants to add timestamps to a bunch of tables so that they may sort the records in those tables chronologically. All of the tables also have a

相关标签:
7条回答
  • 2021-01-01 19:36

    @MadBreaker

    There's to separate things, if you need to know the order you create a column order with autoincrement, however if you want to know the date and time it was inserted you use datetime2.

    Chronological order can be garanteed if you don't allow updates or deletes, but if you want time control over select you should use datetime2.

    0 讨论(0)
提交回复
热议问题