Home > T-SQL > SQL Server Instance Information

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.

Example:

pic1@@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.

Example:

pic2I 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.

pic3Example 2: get all information without parameter

pic4Summary

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.

Advertisements
Categories: T-SQL Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: