There are several ways to know the version of SQL Server. But did you know that there are two system procedures through which you can know the version? They are SP_SERVER_INFO and EXEC XP_MSVER
EXEC sp_SERVER_INFO
If you execute the above, you get a result set with informations about the server. The second will tell you the version number
Result is
attribute_id attribute_name attribute_value
———— ——————– —————-
1 DBMS_NAME Microsoft SQL Server
2 DBMS_VER Microsoft SQL Server 2012 – 11.0.3000.0
.
.
.
.
EXEC xp_MSVER
This is also very similar to SP_SERVER_INFO which will show you the version number (second row from the result set)
Result is
Index Name Internal_Value Character_Value
—— ——————————– ————– ——————-
1 ProductName NULL Microsoft SQL Server
2 ProductVersion 720896 11.0.3153.0
.
.
.
Reference:Â Pinal Dave (https://blog.sqlauthority.com)