Sunday, June 30, 2024

How to get the version of Microsoft SQL Server Database ? 3 Examples

The easiest way to find the version of SQL SERVER you are running is executing SELECT @@VERSION query into SQL Server Management Studio. It will display full detail of product as shown below :

SELECT @@VERSION

This will print product, version, operating system and other details.

It will print Many times while working with SQL SERVER database, we need the version and this is the quickest way to get it.

But this is not the only way, you can also get the SQL SERVER version from Object explorer by right click on any node and looking at details, which we will learn in this article. 

Why Knowing Your SQL Server Version is Important

Before we start, let's talk about why this matters. Knowing your SQL Server version is like knowing which grade you're in at school. It helps you:

  1. Use the right tools and tricks
  2. Keep your database safe and happy
  3. Know when it's time for an upgrade

Now, let's dive into our three easy ways to find out your SQL Server version!

In this blog post we will se three examples of how to get the SQL Server version:

  • Using the @@VERSION command
  • Using the SERVERPROPERTY function
  • Checking the version in SQL Server Management Studio

Example 1: Ask SQL Server Directly

Imagine you could ask SQL Server, "Hey, how old are you?" Well, you can! Here's how:

SELECT @@VERSION

When you run this, SQL Server will tell you everything about itself, including its version. It's like it's introducing itself at a party!

Here is sample output but it can vary depending upon where exactly you are running this 

Microsoft SQL Server 2019 (RTM-CU8) (KB5000642) - 15.0.4083.2 (X64) 

    Feb 15 2021 01:24:17 

    Copyright (C) 2019 Microsoft Corporation

    Developer Edition (64-bit) on Windows 10 Enterprise 10.0 <X64> (Build 19042: )


Example 2: Use a Special Built-in Function

SQL Server has a special function that tells you its version. It's like a secret handshake! Here's how to use it:

SELECT SERVERPROPERTY('ProductVersion')

This will give you a number like "15.0.2000.5". The first part (15) is the main version number.

Example 3: Check the Version in SQL Server Management Studio

If you're using SQL Server Management Studio (SSMS), finding the version is as easy as looking at the label on your lunchbox:

  1. Open SSMS
  2. Connect to your SQL Server
  3. Right-click on the server name
  4. Click on "Properties"
  5. Look for "Version" in the window that pops up

It's like peeking at the answer sheet, but it's okay because it's your own SQL Server as shown below:

How to get the version of Microsoft SQL Server Database ? 3 Examples


That's all about 3 ways to find the version of Microsoft SQL Server. Now you know three super easy ways to find out which version of SQL Server you're using. It's important to know this so you can take good care of your database and use all the cool features available.

Remember, keeping your SQL Server up-to-date is like getting new shoes when you outgrow your old ones. It helps you run faster and do more!

Thank you for reading this article so far. Feel free to ask if you have any doubts or questions, happy to answer any query.