The short answer is, there is no switch to flip or 'mode' that does this.
SQL Server has some built in tools to help with this, but many solutions like this are actually implemented application side. That being said, there might be a couple of ways to accomplish something that might work for this.
Sequence
Assuming that you are using some sort of numeric type for these keys, SQL Server provides a SEQUENCE
object (CREATE SEQUENCE) that can help with providing always incrementing values to multiple other processes (or objects). Think of it like an IDENTITY
object that is not table specific. Per Microsoft,
A sequence is a user-defined schema bound object that generates a sequence of numeric values according to the specification with which the sequence was created.
You are able to add a DEFAULT
contsraint to a column and assign from a sequence (ex: SO: Sequence as default value for a column). So if it was acceptable for your testing, you could add default contraints to all key columns and assign all key values from the same sequence. Personally, I would not recommend that as a production ready solution (I have actually never seen this setup in production), but it does sound like what you are looking for.
uniqueidentifier
Alternatively, if you are using some sort of string type for keys, I have seen many implementations of databases that utilizes the uniqueidentifier, which is basically just a GUID value, type for every single key value in a database. They are of course subject to the same uniqueness
as other GUID types in the Microsoft sphere, which you can read about in many places, but would likely resolve the uniqueness issue you face.
You can acquire new GUIDs values from built in functions like NEWID and you can set column default values for this as well.
This as more of a production ready approach, and I have seen it implemented in many databases. I don't love this option due to additional storage required (when compared to basic int types) and GUID values are a bit harder to work with on a daily basis. But Microsoft provided this type almost specifically for this purpose, and has some decent functionality around using the values across tables.