I tried to create a column IDon the VB.net SQL server that would provide a sequence of numbers for each new row created in the database. Therefore, to create an ID column, I used the following method.
select * from T_Users
ALTER TABLE T_Users
ADD User_ID INT NOT NULL IDENTITY(1,1) Primary Key
Then I registered several usernames in the database and it worked fine. For example, the first six lines will be 1,2,3,4,5,6. Then I registered 4 more users the next day, but this time the ID numbers moved from 6 to A, a very large number, for example: 1,2,3,4,5,6,1002,1003,1004,1005. Then two days later I registered two more users, and new lines - 3002,3004. So my question is why it misses such a large amount every other day when I register users. Is the technique I used to create the sequence wrong? If this is wrong, can someone tell me how to do it right? Now that I have become disillusioned with the technique described above, I tried using sequentially generated GUID values.A sequence of GUID values was generated by a penalty. However, the only drawback is that it generates very long numbers (4 times the size of INT). My question here is does the GUID take any significant advantage over INT?
Hello,
source
share