sqlserver_query2_查看資料庫資訊|查看伺服器名稱|查看執行個體名

來源:互聯網
上載者:User

標籤:ima   display   sele   技術   sqlserver   變數   alt   pre   code   

  • 時間:2017-09-29 編輯:byzqy

本篇記錄幾個查詢資料庫資訊的 T-SQL 陳述式:

  • 查看資料庫資訊
  • 查看伺服器名稱
  • 查看執行個體名

檔案:SQLQuery2.sql

/*說明: SQLQuery2.sql (這是在SQL Server Management Studio中建立的一個查詢)OS名稱: Microsoft Windows 7環境:Microsoft SQL Server 2012工具: Microsoft SQL Server Management Studio*/--全域變數查看資料庫資訊print ‘伺服器的名稱:‘+@@SERVERNAMEprint ‘SQL Server的版本:‘+@@VERSIONselect @@SERVERNAME as ‘伺服器名稱‘select @@VERSION as ‘SQL Server的版本‘--查詢所有資料庫資訊sp_helpdb--查看伺服器名稱和執行個體名稱是否一致select @@SERVERNAME as 伺服器名,serverproperty(‘servername‘) as 執行個體名--一個執行個體名一個伺服器名select @@SERVERNAME select serverproperty(‘servername‘)
View Code

:

01

02

03

04

 

--The End.

sqlserver_query2_查看資料庫資訊|查看伺服器名稱|查看執行個體名

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.