Sqlserver_query2_ View Database Information | View server name | View instance Name

Source: Internet
Author: User
Tags microsoft sql server management studio sql server management sql server management studio

    • Date: 2017-09-29 Editor: Byzqy

This article records several T-SQL statements that query database information:

    • View database Information
    • View server name
    • View instance Name

Files: Sqlquery2.sql

/*Description: Sqlquery2.sql (This is a new query in SQL Server Management Studio) OS name: Microsoft Windows 7 Environment: Microsoft SQL Server 2012 tools: Mi Crosoft SQL Server Management Studio*/--Global Variables View database informationPrint 'name of the server:'+@ @SERVERNAMEPrint 'version of SQL Server:'+@ @VERSIONSelect @ @SERVERNAME  as 'Server name'Select @ @VERSION  as 'version of SQL Server'--Querying all database informationsp_helpdb--See if the server name and instance name are consistentSelect @ @SERVERNAME  asServer name, SERVERPROPERTY ('servername') asInstance Name--An instance name a server nameSelect @ @SERVERNAME SelectSERVERPROPERTY ('servername')
View Code

01

02

03

04

--the End.

Sqlserver_query2_ View Database Information | View server name | View instance Name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.