SQL Server Instance Information
We have got lot of functions in SQL Server to know about the SQL Server instance and server environment information. It helps administrator to understand database environment and keep the server up-to-date with latest release updates. It also helps SQL developer to control the execution of T-SQL statements with deprecated features.
@@Version: Returns version, processor architecture, build date, and operating system for the current installation of SQL Server.
@@version function returns everything in one line and it is bit hard to break this line to get a specific information such as SQL version no, SQL edition and etc. Don’t worry we have got another function.
SERVERPROPERTY(propertyname): this function returns individual properties that relate to the version information.
I have printed few property information in this example and there are many properties which may be very helpful. You can learn more about other properties here.
xp_msver: it is a SQL Server extended stored procedure. It gives version information about Microsoft SQL Server. It also returns information about the actual build number of the server.
We can use this procedure to get a list of information about the server or use the option parameter to get only the specific information of the server.
Example 1: execute the procedure with parameter.
We have learned 2 functions and a stored procedure to got SQL Server information. These information help us to write logic for platform-independent code.