Phil Parkin - Saturday, February 10, 2018 11:03 AM
This, in my opinion, is the key question. If the tables are related, I'd create an identity column on the parent and then the child table could reference the parent table by way of a foreign key.
If the tables aren't related, then they wouldn't necessarily (from a database perspective) need to have sequential numbering across both of them. If there's a business need that they have unique numbers across both of them, you might want to look into a sequence object. See https://docs.microsoft.com/en-us/sql/t-sql/statements/create-sequence-transact-sql. Just be sure to start with the minimum value you can accept when you create it. There's a section on that page on caching you'll want to understand as well. This might do what you need.
I've not had to use sequences in SQL Server, but I have in Oracle years ago because Oracle didn't have an identity property for a column back then. I don't know about now.