I want to add an identity column to a table that does not have an ID column so far using
Alter Table Names
Add Id_new Int Identity(1, 1)
EDIT: My question seemed to have led to some confusion, so I try to clarif: We got a few thousand tables from a customer to do analysis. Most of them do not have and ID column. We load the tables from the client, however do not know what is inside. For further analysis we want to add our own ID column.
It might happen, that the edited tables might be accidentally dropped. When this happens, we need be able to reload the data, add again the ID column and the ID column has to be exactly the same order as it was the first time we loaded the data. Otherwise, if we refer to a the ID in a downstream analysis, we would refer to a different row than before.
So: Is it the case, that the ID numbers added to a table are always the same order, given that the data in the table is the same?
Remarks: With my colleagues we discussed the possibility that we could use an order by clause over all columns. That would create what we want. However, we have thousands of tables, so this would be quite a pain. The data is a dump that we want to analyze for a client. So the question is, if there is an easier, reproducible way to add and ID to all rows in all tables.