When you look at a SQL Server build number (actually a "Product Version", you'll see they have a format like this:
The first number is the major version number. The second number is the minor version number. The third number is the build number. The fourth number is the release number.
These numbers are a little awkward to work with directly in T-SQL so, in our free SDU Tools for developers and DBAs, we added a set of tools that can do that for you.
ProductVersionToMajorVersion extracts the major version from a product version.
ProductVersionToMinorVersion extracts the minor version from a product version.
ProductVersionToBuild extracts the build number from a product version.
ProductVersionToRelease extracts the release number from a product version.
All the above functions take a ProductVersion as a parameter.
We also added a table-valued function ProductVersionComponents that extracts all the values from a product version at once.
Find out more
You can see them 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: