2017-08-16 50 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

谢谢。如果有一种方法可以动态选择所有选项,那将会很不错。 –