Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Server.Databases Property


Represents a collection of Database objects. Each Database object represents a database defined on the instance of SQL Server.

Namespace:   Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)

    SfcContainerCardinality.ZeroToAny, typeof(Database), SfcObjectFlags.Design)>]
member Databases : DatabaseCollection with get

Property Value

Type: Microsoft.SqlServer.Management.Smo.DatabaseCollection

A DatabaseCollection object that represents all the databases defined on the instance of SQL Server.

Specific databases can be referenced by using this collection and specifying the name of the database. To create a new database, call the database constructor Database.

Visual Basic


$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = $srv.Databases.Item("AdventureWorks2012")
$tb = $db.Tables.Item("Person", "Person")
$col = $tb.Columns.Item("LastName")
$col.Nullable = $TRUE
Return to top
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft