Tuesday, October 04, 2011

How to get the database property settings value

--DATABASEPROPERTYEX() Returns the current setting of the specified database option or property

SELECT DATABASEPROPERTYEX('AdventureWorks', 'Collation')
SELECT DATABASEPROPERTYEX('AdventureWorks', 'SQLSortOrder') --0 = Database is using Windows collation
SELECT DATABASEPROPERTYEX('AdventureWorks', 'IsAutoShrink')
SELECT DATABASEPROPERTYEX('AdventureWorks', 'IsAutoCreateStatistics')
SELECT DATABASEPROPERTYEX('AdventureWorks', 'IsAutoUpdateStatistics')
SELECT DATABASEPROPERTYEX('AdventureWorks', 'IsFulltextEnabled')
SELECT DATABASEPROPERTYEX('AdventureWorks', 'IsTornPageDetectionEnabled')
SELECT DATABASEPROPERTYEX('AdventureWorks', 'Recovery')
SELECT DATABASEPROPERTYEX('AdventureWorks', 'Status')
SELECT DATABASEPROPERTYEX('AdventureWorks', 'Version')
SELECT DATABASEPROPERTYEX('AdventureWorks', 'UserAccess')
SELECT DATABASEPROPERTYEX('AdventureWorks', 'IsPublished')
SELECT DATABASEPROPERTYEX('AdventureWorks', 'IsMergePublished')
SELECT DATABASEPROPERTYEX('AdventureWorks', 'IsSubscribed')