SQL Server　設定取得

自分用メモです。これから随時更新予定

そもそもこれが使える
https://enterprisezine.jp/article/detail/9252

```ruby:インスタンス設定取得　
SELECT
	SERVERPROPERTY('BuildClrVersion') AS BuildClrVersion,
	SERVERPROPERTY('Collation') AS Collation,
	SERVERPROPERTY('CollationID') AS CollationID,
	SERVERPROPERTY('ComparisonStyle') AS ComparisonStyle,
	SERVERPROPERTY('ComputerNamePhysicalNetBIOS') AS ComputerNamePhysicalNetBIOS,
	SERVERPROPERTY('Edition') AS Edition,
	SERVERPROPERTY('EditionID') AS EditionID,
	SERVERPROPERTY('EngineEdition') AS EngineEdition,
	SERVERPROPERTY('FilestreamConfiguredLevel') AS FilestreamConfiguredLevel,
	SERVERPROPERTY('FilestreamEffectiveLevel') AS FilestreamEffectiveLevel,
	SERVERPROPERTY('FilestreamShareName') AS FilestreamShareName,
	SERVERPROPERTY('HadrManagerStatus') AS HadrManagerStatus,
	SERVERPROPERTY('InstanceDefaultBackupPath') AS InstanceDefaultBackupPath,
	SERVERPROPERTY('InstanceDefaultDataPath') AS InstanceDefaultDataPath,
	SERVERPROPERTY('InstanceDefaultLogPath') AS InstanceDefaultLogPath,
	SERVERPROPERTY('InstanceName') AS InstanceName,
	SERVERPROPERTY('IsAdvancedAnalyticsInstalled') AS IsAdvancedAnalyticsInstalled,
	SERVERPROPERTY('IsBigDataCluster') AS IsBigDataCluster,
	SERVERPROPERTY('IsClustered') AS IsClustered,
	SERVERPROPERTY('IsFullTextInstalled') AS IsFullTextInstalled,
	SERVERPROPERTY('IsHadrEnabled') AS IsHadrEnabled,
	SERVERPROPERTY('IsIntegratedSecurityOnly') AS IsIntegratedSecurityOnly,
	SERVERPROPERTY('IsLocalDB') AS IsLocalDB,
	SERVERPROPERTY('IsPolyBaseInstalled') AS IsPolyBaseInstalled,
	SERVERPROPERTY('IsSingleUser') AS IsSingleUser,
	SERVERPROPERTY('IsTempDbMetadataMemoryOptimized') AS IsTempDbMetadataMemoryOptimized,
	SERVERPROPERTY('IsXTPSupported') AS IsXTPSupported,
	SERVERPROPERTY('LCID') AS LCID,
	SERVERPROPERTY('LicenseType') AS LicenseType,
	SERVERPROPERTY('MachineName') AS MachineName,
	SERVERPROPERTY('NumLicenses') AS NumLicenses,
	SERVERPROPERTY('ProcessID') AS ProcessID,
	SERVERPROPERTY('ProductBuild') AS ProductBuild,
	SERVERPROPERTY('ProductBuildType') AS ProductBuildType,
	SERVERPROPERTY('ProductLevel') AS ProductLevel,
	SERVERPROPERTY('ProductMajorVersion') AS ProductMajorVersion,
	SERVERPROPERTY('ProductMinorVersion') AS ProductMinorVersion,
	SERVERPROPERTY('ProductUpdateLevel') AS ProductUpdateLevel,
	SERVERPROPERTY('ProductUpdateReference') AS ProductUpdateReference,
	SERVERPROPERTY('ProductVersion') AS ProductVersion,
	SERVERPROPERTY('ResourceLastUpdateDateTime') AS ResourceLastUpdateDateTime,
	SERVERPROPERTY('ResourceVersion') AS ResourceVersion,
	SERVERPROPERTY('ServerName') AS ServerName,
	SERVERPROPERTY('SqlCharSet') AS SqlCharSet,
	SERVERPROPERTY('SqlCharSetName') AS SqlCharSetName,
	SERVERPROPERTY('SqlSortOrder') AS SqlSortOrder,
	SERVERPROPERTY('SqlSortOrderName') AS SqlSortOrderName
GO
```
参照
https://docs.microsoft.com/ja-jp/sql/t-sql/functions/serverproperty-transact-sql?view=sql-server-ver15

照合順序とは、SQL Serverで、データの文字の大小関係を比較する場合の基準となるものを、照合順序（Collation）と呼んでいます。例えば、アルファベットの「a」「A」、かなの「あ」「ア」「ｱ」を小さいほうから順に並べたらどう並ぶか、漢字の「川」「皮」ではどちらが大きいのかなどの、文字の大小関係を決めているものになります。

```ruby:DB設定取得
select * from sys.databases
```
参照
https://docs.microsoft.com/ja-jp/sql/relational-databases/system-catalog-views/sys-databases-transact-sql?view=sql-server-ver15