I like to have my databases at the same database compatibility level as the server, whenever possible. But how do you know the maximum value that's allowed? We recently added a tool to our free SDU Tools for developers and DBAs to solve this. It's called ServerMaximumDBCompatibilityLevel.
It's a simple scalar function that returns the maximum DB compatibility level that's supported by the server. It takes no parameters.
If you want to know which server version (like 2017 or 2019) that the DB compatibility level represents, you can also combine it with our SQLServerVersionForCompatibilityLevel function.
You can use our tools as a set or as a great example of how to write functions like these.
Find out more
You can see it in action in the main image above, and in the video here:
Access to SDU Tools is one of the benefits of being an SDU Insider, along with access to our other free tools and eBooks. Please just visit here for more info: