Database Class

Definition

Instance class encapsulating : Server[@Name='']/Database

[Microsoft.SqlServer.Management.Facets.EvaluationMode(Microsoft.SqlServer.Management.Dmf.AutomatedPolicyEvaluationMode.CheckOnSchedule)]
[Microsoft.SqlServer.Management.Sdk.Sfc.PhysicalFacet]
public sealed class Database : Microsoft.SqlServer.Management.Smo.ScriptNameObjectBase, Microsoft.SqlServer.Management.Common.IAlterable, Microsoft.SqlServer.Management.Common.ICreatable, Microsoft.SqlServer.Management.Common.IDropIfExists, Microsoft.SqlServer.Management.Common.IDroppable, Microsoft.SqlServer.Management.Common.ISafeRenamable, Microsoft.SqlServer.Management.Sdk.Sfc.IDmfFacet, Microsoft.SqlServer.Management.Sdk.Sfc.ISfcSupportsDesignMode, Microsoft.SqlServer.Management.Smo.IDatabaseOptions, Microsoft.SqlServer.Management.Smo.IExtendedProperties, Microsoft.SqlServer.Management.Smo.IScriptable
[<Microsoft.SqlServer.Management.Facets.EvaluationMode(Microsoft.SqlServer.Management.Dmf.AutomatedPolicyEvaluationMode.CheckOnSchedule)>]
[<Microsoft.SqlServer.Management.Sdk.Sfc.PhysicalFacet>]
type Database = class
    inherit ScriptNameObjectBase
    interface ISfcSupportsDesignMode
    interface ICreatable
    interface IAlterable
    interface IDroppable
    interface IDropIfExists
    interface ISafeRenamable
    interface IRenamable
    interface IExtendedProperties
    interface IScriptable
    interface IDatabaseOptions
    interface IDmfFacet
[<Microsoft.SqlServer.Management.Facets.EvaluationMode(Microsoft.SqlServer.Management.Dmf.AutomatedPolicyEvaluationMode.CheckOnSchedule)>]
[<Microsoft.SqlServer.Management.Sdk.Sfc.PhysicalFacet>]
type Database = class
    inherit ScriptNameObjectBase
    interface ICreatable
    interface IAlterable
    interface IDroppable
    interface IDropIfExists
    interface ISafeRenamable
    interface IRenamable
    interface IExtendedProperties
    interface IScriptable
    interface IDatabaseOptions
    interface IDmfFacet
    interface ISfcSupportsDesignMode
Public NotInheritable Class Database
Inherits ScriptNameObjectBase
Implements IAlterable, ICreatable, IDatabaseOptions, IDmfFacet, IDropIfExists, IDroppable, IExtendedProperties, ISafeRenamable, IScriptable, ISfcSupportsDesignMode
Inheritance
Attributes
Implements

Constructors

Database()
Database(Server, String)
Database(Server, String, DatabaseEngineEdition)

Constructs a new Database object to be created with the given edition

Fields

m_ExtendedProperties (Inherited from SqlSmoObject)
singletonParent

Regular SMO objects access the parent class reference through parentColl (corresponding collection in parent class). Singleton class has no collection in parent.

(Inherited from SqlSmoObject)

Properties

ActiveConnections
ActiveDirectory
AnsiNullDefault
AnsiNullsEnabled
AnsiPaddingEnabled
AnsiWarningsEnabled
ApplicationRoles
ArithmeticAbortEnabled
Assemblies
AsymmetricKeys
AutoClose
AutoCreateIncrementalStatisticsEnabled
AutoCreateStatisticsEnabled
AutoShrink
AutoUpdateStatisticsAsync
AutoUpdateStatisticsEnabled
AvailabilityDatabaseSynchronizationState
AvailabilityGroupName
AzureEdition
AzureServiceObjective
BrokerEnabled
CaseSensitive
CatalogCollation

Gets or sets the MD Catalog Collation type. Only valid during creation, and we cannot specify ContainedDatabaseCollation explicitly

Certificates
ChangeTrackingAutoCleanUp
ChangeTrackingEnabled
ChangeTrackingRetentionPeriod
ChangeTrackingRetentionPeriodUnits
CloseCursorsOnCommitEnabled
Collation
ColumnEncryptionKeys
ColumnMasterKeys
CompatibilityLevel
ConcatenateNullYieldsNull
ContainmentType
CreateDate
DatabaseAuditSpecifications

DatabaseAuditSpecification Collection

DatabaseEncryptionKey
DatabaseEngineEdition
DatabaseEngineType
DatabaseGuid
DatabaseOptions
DatabaseOwnershipChaining
DatabaseScopedConfigurations
DatabaseScopedCredentials
DatabaseSnapshotBaseName
DataSpaceUsage
DateCorrelationOptimization
DboLogin
DefaultFileGroup
DefaultFileStreamFileGroup
DefaultFullTextCatalog
DefaultFullTextLanguage

Gets or sets the default fulltext language of this database.

DefaultLanguage

Gets or sets the default language for the users of this database.

Defaults
DefaultSchema
DelayedDurability
EncryptionEnabled
Events
ExecuteForScalar (Inherited from SqlSmoObject)
ExecutionManager
ExtendedProperties
ExtendedStoredProcedures
ExternalDataSources
ExternalFileFormats
ExternalLibraries
FeatureRestrictions
FileGroups
FilestreamDirectoryName
FilestreamNonTransactedAccess
FullTextCatalogs
FullTextStopLists
HasDatabaseEncryptionKey
HasFileInCloud
HasMemoryOptimizedObjects
HonorBrokerPriority
ID
IndexSpaceUsage
IsAccessible
IsDatabaseSnapshot
IsDatabaseSnapshotBase
IsDbAccessAdmin
IsDbBackupOperator
IsDbDatareader
IsDbDatawriter
IsDbDdlAdmin
IsDbDenyDatareader
IsDbDenyDatawriter
IsDbManager
IsDbOwner
IsDbSecurityAdmin
IsFullTextEnabled
IsLoginManager
IsMailHost
IsManagementDataWarehouse
IsMirroringEnabled
IsParameterizationForced
IsReadCommittedSnapshotOn
IsSqlDw
IsSqlDwEdition
IsSystemObject
IsTouched

Whether the object has been touched for unconditional scripting of Alter

(Inherited from SqlSmoObject)
IsUpdateable
IsVarDecimalStorageFormatEnabled

Whether vardecimal compression is enabled

IsVarDecimalStorageFormatSupported

Whether vardecimal compression is supported on the server

LastBackupDate
LastDifferentialBackupDate
LastGoodCheckDbTime
LastLogBackupDate
LegacyCardinalityEstimation

Get or set the Legacy_Cardinality_Estimation of the database scoped configuration.

LegacyCardinalityEstimationForSecondary

Get or set the Legacy_Cardinality_Estimation for secondary of the database scoped configuration.

LocalCursorsDefault
LogFiles
LogReuseWaitStatus
MasterKey
MaxDop

Gets or sets the MaxDop of the database scoped configuration.

MaxDopForSecondary

Get or set the MaxDop for secondary of the database scoped configuration special accounting for nulls.

MaxSizeInBytes
MemoryAllocatedToMemoryOptimizedObjectsInKB
MemoryUsedByMemoryOptimizedObjectsInKB
MirroringFailoverLogSequenceNumber
MirroringID
MirroringPartner
MirroringPartnerInstance
MirroringRedoQueueMaxSize
MirroringRoleSequence
MirroringSafetyLevel
MirroringSafetySequence
MirroringStatus
MirroringTimeout
MirroringWitness
MirroringWitnessStatus
Name
NestedTriggersEnabled
NumericRoundAbortEnabled
ObjectInSpace (Inherited from SqlSmoObject)
Owner
PageVerify
ParameterSniffing

Get or set the Parameter_Sniffing of the database scoped configuration.

ParameterSniffingForSecondary

Get or set the Parameter_Sniffing for secondary of the database scoped configuration.

Parent
ParentCollection

Returns the collection that contains the object. May be null.

(Inherited from SqlSmoObject)
PartitionFunctions
PartitionSchemes
PlanGuides
PrimaryFilePath
Properties (Inherited from SqlSmoObject)
QueryOptimizerHotfixes

Get or set the Query_Optimizer_Hotfixes of the database scoped configuration.

QueryOptimizerHotfixesForSecondary

Get or set the Query_Optimizer_Hotfixes for secondary of the database scoped configuration.

QueryStoreOptions
QuotedIdentifiersEnabled
ReadOnly
RecoveryForkGuid
RecoveryModel
RecursiveTriggersEnabled
RemoteDataArchiveCredential
RemoteDataArchiveEnabled
RemoteDataArchiveEndpoint
RemoteDataArchiveLinkedServer
RemoteDataArchiveUseFederatedServiceAccount
RemoteDatabaseName
ReplicationOptions
Roles
Rules
ScalarResult (Inherited from SqlSmoObject)
Schemas
SearchPropertyLists
SecurityPolicies
Sequences
ServerVersion

Returns the ServerVersion of the Server that contains the object. If the object is not associated with a connected Server, the highest known server version is returned.

(Inherited from SqlSmoObject)
ServiceBroker
ServiceBrokerGuid
Size
SnapshotIsolationState
SpaceAvailable
State

Returns the state of the object

(Inherited from SmoObjectBase)
Status
StoredProcedures
SymmetricKeys
Synonyms
Tables
TargetRecoveryTime
TemporalHistoryRetentionEnabled
TransformNoiseWords
Triggers
Trustworthy
TwoDigitYearCutoff
Urn

Returns the Urn of the object, computed on the fly

(Inherited from SqlSmoObject)
UrnSuffix

Returns the name of the type in the urn expression

UserAccess
UserData (Inherited from SmoObjectBase)
UserDefinedAggregates
UserDefinedDataTypes
UserDefinedFunctions
UserDefinedTableTypes
UserDefinedTypes
UserName
Users
Version
Views
WarnOnRename

Renaming a database should ask for confirmation

XmlSchemaCollections

Methods

AddDatabaseContext(StringCollection)

method get called from the create script related method (from derived classes like Table, Index etc..)

(Inherited from SqlSmoObject)
Alter()
Alter(TerminationClause)
Alter(TimeSpan)
AlterImpl() (Inherited from SqlSmoObject)
AlterImplWorker() (Inherited from SqlSmoObject)
AppendCommaText(StringBuilder, String, Boolean, String) (Inherited from ScriptNameObjectBase)
AppendWithCommaText(StringBuilder, String, Boolean) (Inherited from ScriptNameObjectBase)
AppendWithOption(StringBuilder, String, String, Boolean) (Inherited from ScriptNameObjectBase)
AutoGenerateName() (Inherited from ScriptNameObjectBase)
BindDefaultImpl(String, String, Boolean) (Inherited from SqlSmoObject)
BindRuleImpl(String, String, Boolean) (Inherited from SqlSmoObject)
ChangeMirroringState(MirroringOption)

Alters the database mirroring status

CheckAllocations(RepairType)

CheckAllocations

CheckAllocationsDataOnly()

Wrapper for DBCC CHECKALLOC NOINDEX

CheckCatalog()

Wrapper for DBCC CHECKCATALOG

CheckIdentityValues()
CheckObjectDirty()

If there are some properties which are respected in special cases then use this function. currently applicable for DatabaseDdltriggers

(Inherited from ScriptNameObjectBase)
CheckObjectState() (Inherited from SqlSmoObject)
CheckObjectState(Boolean)

This is a virtual function, so that derived classes can override it if they want to do additional checks on the state of the object

(Inherited from SqlSmoObject)
CheckObjectStateImpl(Boolean)

Checks object state Because it is not recusrive, this function can be called directly and which means derived classes can't supply their own validation

(Inherited from SqlSmoObject)
Checkpoint()

Performs the CHECKPOINT command against the current database

CheckTables(RepairType)

Invokes DBCC CHECKDB with the given repair type and NO_INFOMSGS

CheckTables(RepairType, RepairOptions)

Invokes DBCC CHECKDB with the given repair type and repair options

CheckTables(RepairType, RepairOptions, RepairStructure, Nullable<Int64>)

Invokes DBCC CHECKDB with the given options

CheckTables(RepairType, RepairStructure)

Invokes DBCC CHECKDB with the given repair type and repair structure

CheckTablesDataOnly()

Invokes DBCC CHECKDB with the NOINDEX option

CheckTablesDataOnly(RepairOptions)

Invokes DBCC CHECKDB with the NO_INDEX option and the given repair options

CheckTablesDataOnly(RepairOptions, RepairStructure, Nullable<Int64>)

Invokes DBCC CHECKDB with the NO_INDEX option and the given repair options and repair structure.

CheckTablesDataOnly(RepairStructure)

Invokes DBCC CHECKDB with the NO_INDEX option and the given repair structure

CheckTextCorrectness(String, Boolean, Boolean, Boolean, String[], DdlTextParserHeaderInfo)

checks text syntax, that it manipulates the right type of object ( PROC, TRIGGER, etc )

(Inherited from ScriptNameObjectBase)
CheckTextCorrectness(String, Boolean, Boolean, String[], DdlTextParserHeaderInfo)

checks text syntax, that it manipulates the right type of object ( PROC, TRIGGER, etc )

(Inherited from ScriptNameObjectBase)
CheckTextModeSupport() (Inherited from ScriptNameObjectBase)
CleanObject() (Inherited from ScriptNameObjectBase)
Create()

Creates the database on the instance of SQL Server.

Create(Boolean)

Creates the database on the instance of SQL Server

CreateImpl() (Inherited from SqlSmoObject)
CreateOrAlterImpl() (Inherited from SqlSmoObject)
Deny(DatabasePermissionSet, String)
Deny(DatabasePermissionSet, String, Boolean)
Deny(DatabasePermissionSet, String[])
Deny(DatabasePermissionSet, String[], Boolean)
DisableAllPlanGuides()

DISABLE all the planguides

Discover()

Best Effort Discovery mechanism : This method reflects upon metadata and gets all available objects

(Inherited from SqlSmoObject)
Drop()

Drops the database

DropAllPlanGuides()

DROP all the planguides

DropBackupHistory()

Deletes the entries in the backup and restore history tables for database

DropIfExists()

Drops the object with IF EXISTS option. If object is invalid for drop function will return without exception.

DropImpl(Boolean)

drops the object

(Inherited from SqlSmoObject)
DropImpl(Boolean, Boolean)

For drop calls on the user database in Azure, the connection will be closed as the database is dropped The ExecutionManager will normally attempt to retry such calls by reopening the connection We want to avoid this retry when handleSevereError is true.

(Inherited from SqlSmoObject)
DropImplWorker(Urn, Boolean)

drops the object

(Inherited from SqlSmoObject)
EnableAllPlanGuides()

ENABLE all the planguides

EnableEncryption(Boolean)

Enables or disables encryption

EnumBackupSetFiles()

Returns information about all backup set files for the database

EnumBackupSetFiles(Int32)

Returns information about the files included in the given backup set

EnumBackupSets()

Returns information about all the backup sets for the database

EnumCandidateKeys()

The EnumCandidateKeys method returns a QueryResults object that enumerates the user tables of a Microsoft® SQL Server™ 2000 database and the constraints on those tables that could define primary keys.

EnumDatabasePermissions()
EnumDatabasePermissions(DatabasePermissionSet)
EnumDatabasePermissions(String)
EnumDatabasePermissions(String, DatabasePermissionSet)
EnumLocks()

EnumLocks

EnumLocks(Int32)

EnumLocks

EnumLoginMappings()

EnumLoginMappings

EnumMatchingSPs(String)

The EnumMatchingSPs method returns a QueryResults object that enumerates the stored procedures that contain the specified search text

EnumMatchingSPs(String, Boolean)

The EnumMatchingSPs method returns a QueryResults object that enumerates the stored procedures that contain the specified search text

EnumObjectPermissions()
EnumObjectPermissions(ObjectPermissionSet)
EnumObjectPermissions(String)
EnumObjectPermissions(String, ObjectPermissionSet)
EnumObjects()
EnumObjects(DatabaseObjectTypes)
EnumObjects(DatabaseObjectTypes, SortOrder)

The ListObjects method returns a SQLObjectList object that enumerates the system and user-defined objects defining the database referenced.

EnumTransactions()

Returns a set of active transactions

EnumTransactions(TransactionTypes)

Returns a set of active transactions

EnumWindowsGroups()

EnumWindowsGroups

EnumWindowsGroups(String)

EnumWindowsGroups

ExecuteNonQuery(String)
ExecuteNonQuery(String, ExecutionTypes)
ExecuteNonQuery(StringCollection)
ExecuteNonQuery(StringCollection, Boolean, Boolean)

Executes sql statements

(Inherited from SqlSmoObject)
ExecuteNonQuery(StringCollection, ExecutionTypes)
ExecuteRenameQuery(String)

Creates the Rename query for a SqlSmoObject and Executes it on the Server.

(Inherited from NamedSmoObject)
ExecuteWithModes(SqlExecutionModes, Action)

Executes the given action under the given execution modes.

Resets the original modes after the action completes or fails.

(Inherited from SqlSmoObject)
ExecuteWithResults(String)
ExecuteWithResults(StringCollection)
ForceTextModeOnTextBody() (Inherited from ScriptNameObjectBase)
FormatSqlVariant(Object) (Inherited from SqlSmoObject)
GenerateAlterEvent() (Inherited from SqlSmoObject)
GenerateAlterEvent(Urn, Object) (Inherited from SqlSmoObject)
GetBraketNameForText() (Inherited from ScriptNameObjectBase)
GetContextDB() (Inherited from SqlSmoObject)
GetDBName() (Inherited from SqlSmoObject)
GetDisabledProperties(ScriptingPreferences)

Provides an enumerable of properties that are explicitly disabled for specific server types or editions. This is not a list of all properties that don't work for the specified target.

(Inherited from SqlSmoObject)
GetFragOptionString(FragmentationOption) (Inherited from SqlSmoObject)
GetIsSystemNamed() (Inherited from ScriptNameObjectBase)
GetIsTextDirty() (Inherited from ScriptNameObjectBase)
GetPropValue(String)

Retrieve the property value from : - The property bag directly if property is available (dirty or retrieved) - A call to our OnPropertyMissing method otherwise

Will throw an exception if the property value is NULL in either case.

(Inherited from SqlSmoObject)
GetPropValueOptional(String)

Retrieve the property value from : - The property bag if the state is creating or we're in Design Mode (possible NULL value) - A call to our OnPropertyMissing method otherwise (will throw exception if value is NULL)

(Inherited from SqlSmoObject)
GetPropValueOptional<T>(String, T)

Returns the value of the named property. If the object is in the Creating state and the property has not yet been set the defaultValue is returned. If the object exists the defaultValue is ignored and the actual value is returned.

(Inherited from SqlSmoObject)
GetPropValueOptionalAllowNull(String)

Retrieve the property value from : - The property bag if the state is creating or we're in Design Mode (possible NULL) - A call to our OnPropertyMissing method otherwise (possible NULL)

(Inherited from SqlSmoObject)
GetRealValue(Property, Object)

Returns the real value for the property.

(Inherited from SqlSmoObject)
GetRemoteDataArchiveMigrationStatusReports(DateTime, Int32, String)

Gets a list of remote data archive migration status reports

GetRemoteDatabaseMigrationStatistics()

Get remote database migration statistics. Null if Remote Data Archive is not enabled for database

GetServerName() (Inherited from SqlSmoObject)
GetServerObject() (Inherited from SqlSmoObject)
GetSqlServerVersionName()

Gets the sqlserver public name for the current connection, e.g: will transfer "SQLTOOLS2008-2" to "SQL Server 2008".

(Inherited from SqlSmoObject)
GetStringComparer()

Returns the comparer used by all child object collections to perform comparison of object names. The comparer of a Server is based on the collation of master The comparer of a Database and its children is based on the database collation

(Inherited from SqlSmoObject)
GetTextBody() (Inherited from ScriptNameObjectBase)
GetTextBody(Boolean) (Inherited from ScriptNameObjectBase)
GetTextHeader(Boolean) (Inherited from ScriptNameObjectBase)
GetTextHeader(ScriptNameObjectBase+ScriptHeaderType) (Inherited from ScriptNameObjectBase)
GetTextMode() (Inherited from ScriptNameObjectBase)
GetTextProperty(String)

get the text of the object, if not available, throw apropiate exception based on the State of the object

(Inherited from ScriptNameObjectBase)
GetTransactionCount()

Returns the number of open transactions

GetTransactionCount(TransactionTypes)

Returns the number of open transactions with

GetUrnRecursive(StringBuilder)

Computes the Urn for the object.

(Inherited from SqlSmoObject)
GetUrnRecursive(StringBuilder, UrnIdOption)

Computes the Urn for the object, potentially including other fields in the definition besides the key fields.

(Inherited from SqlSmoObject)
Grant(DatabasePermissionSet, String)
Grant(DatabasePermissionSet, String, Boolean)
Grant(DatabasePermissionSet, String, Boolean, String)
Grant(DatabasePermissionSet, String[])
Grant(DatabasePermissionSet, String[], Boolean)
Grant(DatabasePermissionSet, String[], Boolean, String)
ImplInitialize(String[], OrderBy[]) (Inherited from SqlSmoObject)
InitChildCollection(Urn, Boolean)

Initializes the child object collection associated with the given type. For example, the name Column would initialize the Columns collection.

(Inherited from SqlSmoObject)
InitFileGroupFiles()

Populate the FileGroup collection and each Files collection in each FileGroup optimally.

Initialize() (Inherited from SqlSmoObject)
Initialize(Boolean)

Initializes the object, by reading its properties from the enumerator

(Inherited from SqlSmoObject)
InitializeClassifiedColumns()

Clears Tables collection and initializes it with tables that have classified columns. The caller can always restore Tables collection by calling: db.Tables.ClearAndInitialize()

InitTableColumns()

Populate the Tables collection and each Columns collection in each Table optimally

IsExpressSku()

Returns whether the server containing this object is an Express SKU

(Inherited from SqlSmoObject)
IsLocalPrimaryReplica()

Returns true if the database is part of an Availability Group and resides on the primary replica server

IsMember(String)

Determines if the current user is a member of the given group or role in the current database

IsObjectDirty() (Inherited from ScriptNameObjectBase)
IsObjectInitialized() (Inherited from SqlSmoObject)
IsObjectInSpace() (Inherited from SqlSmoObject)
IsSupportedProperty(String)

Validate whether the specified property is supported in current server environment

(Inherited from SqlSmoObject)
IsVersion80SP3() (Inherited from SqlSmoObject)
IsVersion90AndAbove() (Inherited from SqlSmoObject)
MarkDropped() (Inherited from SqlSmoObject)
MarkForDropImpl(Boolean) (Inherited from SqlSmoObject)
PostAlter()

this function is meant to be overriden by derived classes, if they have to do supplimentary actions after altering the object

(Inherited from SqlSmoObject)
PostCreate()

this function is meant to be overriden by derived classes, if they have to do supplimentary actions after object creation

(Inherited from SqlSmoObject)
PostDrop()

this function is meant to be overriden by derived classes, if they have to do supplimentary actions after dropping the object

(Inherited from SqlSmoObject)
PrefetchObjects()

Initializes all the objects in the database

PrefetchObjects(Type)

Initializes all the objects of type t and their children

PrefetchObjects(Type, ScriptingOptions)

Initializes all the objects of type t and their children needed to script with so

ReauthorizeRemoteDataArchiveConnection(String, Boolean)

Reauthorize a stretched database with the SQL Azure server after the database is restored from a backup

RecalculateSpaceUsage()
Refresh()

refreshes the object's properties by reading them from the server

RemoveFullTextCatalogs()
Rename(String)
RenameImpl(String)

change object name

(Inherited from NamedSmoObject)
RenameImplWorker(String) (Inherited from NamedSmoObject)
Revoke(DatabasePermissionSet, String)
Revoke(DatabasePermissionSet, String, Boolean, Boolean)
Revoke(DatabasePermissionSet, String, Boolean, Boolean, String)
Revoke(DatabasePermissionSet, String[])
Revoke(DatabasePermissionSet, String[], Boolean, Boolean)
Revoke(DatabasePermissionSet, String[], Boolean, Boolean, String)
Script()
Script(ScriptingOptions)
ScriptImpl() (Inherited from SqlSmoObject)
ScriptImpl(ScriptingOptions)

Returns a StringCollection object with the script for the object. This method throws an error if ScriptData is true

(Inherited from SqlSmoObject)
SetAccessToken(IRenewableToken)

Set the accessToken for connection.

(Inherited from SqlSmoObject)
SetCollectionTextMode(Boolean, SmoCollectionBase) (Inherited from ScriptNameObjectBase)
SetDefaultFileGroup(String)

Sets the named file group as the default file group for the database.

SetDefaultFileStreamFileGroup(String)

Sets the named file group as the default file group for the database. It works for any file group, not just filestream

SetDefaultFullTextCatalog(String)
SetIsSystemNamed(Boolean) (Inherited from ScriptNameObjectBase)
SetOffline()
SetOnline()
SetOwner(String)

Sets the owner of this database to the login with the specified name. Does not drop any existing user accounts mapped to the login before attempting to change the owner.

SetOwner(String, Boolean)

Sets the owner of this database to the login with the specified name.

SetParentImpl(SqlSmoObject) (Inherited from SqlSmoObject)
SetSchemaOwned() (Inherited from NamedSmoObject)
SetSnapshotIsolation(Boolean)

Enables or disables snapshot isolation for the current database

SetState(SqlSmoState)

Sets the object state (Existing, Dropped etc.) Applications should avoid using this method.

(Inherited from SmoObjectBase)
SetTextBody(String) (Inherited from ScriptNameObjectBase)
SetTextHeader(String) (Inherited from ScriptNameObjectBase)
SetTextMode(Boolean, SmoCollectionBase[]) (Inherited from ScriptNameObjectBase)
Shrink(Int32, ShrinkMethod)

Shrinks a database

SwitchTextMode(Boolean, SmoCollectionBase[]) (Inherited from ScriptNameObjectBase)
ThrowIfAboveVersion100(String)

Throws an exception if the ServerVersion major version for this object is above 10.0 (SQL 2008)

(Inherited from SqlSmoObject)
ThrowIfAboveVersion80(String)

Throws an exception if the ServerVersion major version for this object is above 8.0 (SQL 2000)

(Inherited from SqlSmoObject)
ThrowIfBelowVersion100(String)

Throws an exception if the ServerVersion major version for this object is below 10.0 (SQL 2008)

(Inherited from SqlSmoObject)
ThrowIfBelowVersion110(String)

Throws an UnsupportedVersionException if either the source or destination server is below 11.0 (SQL 2012)

(Inherited from SqlSmoObject)
ThrowIfBelowVersion110Prop(String)

Throws an exception with text saying the specified property is not supported if the ServerVersion major version for this object is below 11.0 (SQL 2012)

(Inherited from SqlSmoObject)
ThrowIfBelowVersion120(String)

Throws an exception if the ServerVersion major version for this object is below 12.0 (SQL 2014)

(Inherited from SqlSmoObject)
ThrowIfBelowVersion120Prop(String)

Throws an exception with text saying the specified property is not supported if the ServerVersion major version for this object is below 12.0 (SQL 2014)

(Inherited from SqlSmoObject)
ThrowIfBelowVersion130(String)

Throws an exception if the ServerVersion major version for this object is below 13.0 (SQL 2016)

(Inherited from SqlSmoObject)
ThrowIfBelowVersion130Prop(String)

Throws an exception with text saying the specified property is not supported if the ServerVersion major version for this object is below 13.0 (SQL 2016)

(Inherited from SqlSmoObject)
ThrowIfBelowVersion140(String)

Throws an exception if the ServerVersion major version for this object is below 14.0 (SQL 2017)

(Inherited from SqlSmoObject)
ThrowIfBelowVersion140Prop(String)

Throws an exception with text saying the specified property is not supported if the ServerVersion major version for this object is below 14.0 (SQL 2017)

(Inherited from SqlSmoObject)
ThrowIfBelowVersion80(String)

Throws an exception if the ServerVersion major version for this object is below 8.0 (SQL 2000)

(Inherited from SqlSmoObject)
ThrowIfBelowVersion80SP3()

Throws an exception if the ServerVersion for this object is below 8.760 (8.0 SP3)

(Inherited from SqlSmoObject)
ThrowIfBelowVersion90(String)

Throws an exception if the ServerVersion major version for this object is below 9.0 (SQL 2005)

(Inherited from SqlSmoObject)
ThrowIfTextIsDirtyForAlter() (Inherited from ScriptNameObjectBase)
ToString() (Inherited from SqlSmoObject)
Touch()

Mark the object "touched" for unconditional scripting of Alter.

(Inherited from SqlSmoObject)
TouchImpl()

Virtual method to allow derived classes to do additional work when touched.

(Inherited from SqlSmoObject)
TruncateLog()

Truncate log. This is supported in SQL Server 2005 for backwards compatibility reasons.

UnbindDefaultImpl(Boolean) (Inherited from SqlSmoObject)
UnbindRuleImpl(Boolean) (Inherited from SqlSmoObject)
UpdateIndexStatistics()

Update statistics for all indexes in the database.

Validate(String, Object[]) (Inherited from SmoObjectBase)
ValidateAllPlanGuides()

Validate all the planguides

ValidateAllPlanGuides(DataTable)

Validate all the planguides

Events

PropertyChanged (Inherited from SqlSmoObject)
PropertyMetadataChanged (Inherited from SqlSmoObject)

Explicit Interface Implementations

IAlienObject.Discover() (Inherited from SqlSmoObject)
IAlienObject.GetDomainRoot() (Inherited from SqlSmoObject)
IAlienObject.GetParent() (Inherited from SqlSmoObject)
IAlienObject.GetPropertyType(String)

Discovers type of property.

(Inherited from SqlSmoObject)
IAlienObject.GetPropertyValue(String, Type)

Retrieves value for a given property. Throws if property is not found.

(Inherited from SqlSmoObject)
IAlienObject.GetUrn() (Inherited from SqlSmoObject)
IAlienObject.Resolve(String) (Inherited from SqlSmoObject)
IAlienObject.SetObjectState(SfcObjectState)

Sets state of this object based on provided SfcObjectState.

(Inherited from SqlSmoObject)
IAlienObject.SetPropertyValue(String, Type, Object)

Sets the value of given property, if it is writable. If property is not in property bag, reflection is used. Throws exception if the property is not found.

(Inherited from SqlSmoObject)
ISfcPropertyProvider.GetPropertySet() (Inherited from SqlSmoObject)
ISfcSupportsDesignMode.IsDesignMode

This object extend ISfcSupportsDesignMode.

Extension Methods

GetAssessmentItems(Database, String[])

Finds all available checks for given database.

GetAssessmentItems(SqlSmoObject, String[])

Finds all available checks for given smoObject.

GetAssessmentResults(Database, IEnumerable<ICheck>)

Synchronously runs assessment for given database and gives a IEnumerable<T> describing discovered issues. This method performs only given checks from checks.

GetAssessmentResults(Database, String[])

Synchronously runs assessment for given database and gives a IEnumerable<T> describing discovered issues.

GetAssessmentResults(SqlSmoObject, IEnumerable<ICheck>)

Synchronously runs assessment for given smoObject and gives a IEnumerable<T> describing discovered issues. This method performs only given checks from checks.

GetAssessmentResults(SqlSmoObject, String[])

Synchronously runs assessment for given smoObject and gives a IEnumerable<T> describing discovered issues.

GetAssessmentResultsList(Database, IEnumerable<ICheck>)

Synchronously runs assessment for given database and gives a IEnumerable<T> describing discovered issues. This method performs only given checks from checks.

GetAssessmentResultsList(Database, String[])

Asynchronously runs assessment for given database and gives a List<T> describing discovered issues.

GetAssessmentResultsList(SqlSmoObject, IEnumerable<ICheck>)

Asynchronously runs assessment for given smoObject and gives a List<T> describing discovered issues. This method performs only given checks from checks.

GetAssessmentResultsList(SqlSmoObject, String[])

Asynchronously runs assessment for given smoObject and gives a List<T> describing discovered issues.

IsSupportedObject<T>(SqlSmoObject, ScriptingPreferences)

Checks if the specified type is supported by the ServerVersion and DatabaseEngineType of the root server for this object. If ScriptingPreferences are non-null will also check if specified type is supported by the ServerVersion and DatabaseEngineType of the target server.

Applies to