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:
- Use the right tools and tricks
- Keep your database safe and happy
- 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:
- Open SSMS
- Connect to your SQL Server
- Right-click on the server name
- Click on "Properties"
- 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:
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!
- How to use WHERE and HAVING clause in SQL
- How to convert String to Date in SQL?
- Difference between Primary key and Unique key
- Does order of columns matter in Composite index?
- Difference between Self and Equi join in SQL
- 10 Example of SELECT queries in SQL
- 6 Examples of Correlated subqueries for beginners
- How to get rows between two given dates in MSSQL
- How to remove duplicate rows from table in SQL Server
- How to create and rollback transaction in database?
- 4 Examples of CASE expression in SQL Server
- Difference between UNION and UNION ALL in SQL
- 10 Examples of ALTER command in SQL