2017-08-16 67 views

回答

2

您正在尋找DATABASEPROPERTYSERVERPROPERTY

只是列出它們在SELECT聲明,如:

SELECT 
[Service_Name]     = @@SERVICENAME 
,[Server Name]     = SERVERPROPERTY('ServerName') 
,[Physical_Net_BIOS_Name]  = SERVERPROPERTY('ComputerNamePhysicalNetBIOS') 
,[Edition]      = SERVERPROPERTY('Edition') 
,[Product_Version]    = SERVERPROPERTY('ProductVersion') 
,[Product_Update_Reference]  = SERVERPROPERTY('ProductUpdateReference') 
,[Resource_Last_Update_Date] = SERVERPROPERTY('ResourceLastUpdateDateTime') 
,[Process_ID]     = SERVERPROPERTY('ProcessID') 
,[Collation]     = SERVERPROPERTY('Collation') 
,[CLR_Version]     = SERVERPROPERTY('BuildClrVersion') 
,[Is_Clustered]     = SERVERPROPERTY('IsClustered') 
,[Is_FullText_Installed]  = SERVERPROPERTY('IsFullTextInstalled') 
,[Is_Integrated_Security_Only] = SERVERPROPERTY('IsIntegratedSecurityOnly') 
,[File_Stream_Configured_Level] = SERVERPROPERTY('FilestreamConfiguredLevel') 
,[Is_HA_DR_Enabled]    = SERVERPROPERTY('IsHadrEnabled') 
,[HA_DR_Manager_Status]   = SERVERPROPERTY('HadrManagerStatus') 
,[Default_Data_Path]   = SERVERPROPERTY('InstanceDefaultDataPath') 
,[Default_Log_Path]    = SERVERPROPERTY('InstanceDefaultLogPath') 

並添加/刪除你需要的任何財產。

+1

謝謝。如果有一種方法可以動態選擇所有選項,那將會很不錯。 –