Database.EnumObjects Database.EnumObjects Database.EnumObjects Method

Definition

Enumerates a list of objects in the database.

Overloads

EnumObjects() EnumObjects() EnumObjects()

Enumerates a list of objects in the database.

EnumObjects(DatabaseObjectTypes) EnumObjects(DatabaseObjectTypes) EnumObjects(DatabaseObjectTypes)

Enumerates a list of objects in the database.

EnumObjects(DatabaseObjectTypes, SortOrder) EnumObjects(DatabaseObjectTypes, SortOrder) EnumObjects(DatabaseObjectTypes, SortOrder)

Enumerates a list of objects in the database.

EnumObjects() EnumObjects() EnumObjects()

Enumerates a list of objects in the database.

public:
 System::Data::DataTable ^ EnumObjects();
public System.Data.DataTable EnumObjects ();
Public Function EnumObjects () As DataTable
Returns

A DataTable object value that contains a list of objects in the database. The table describes the different columns of the returned DataTable.

Column
Data type
Description.
DatabaseObjectTypes
String The type of database object. See DatabaseObjectTypes enumeration.
Schema
String The schema associated with the referenced object.
Name
String The name of the referenced object.
Urn
String The URN string that represents the referenced object.

Examples

The example runs a Server object enumeration method, but extracting the information from the DataTable object is the same for Database enumeration methods.

VB

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  

$d = new-object System.Data.Datatable  
$d = $srv.EnumCollations  

Foreach ($r in $d.Rows)  
{  
   Write-Host "============================================"  
   Foreach ($c in $d.Columns)  
   {  
      Write-Host $c.ColumnName "=" $r[$c]  
   }  
}  

EnumObjects(DatabaseObjectTypes) EnumObjects(DatabaseObjectTypes) EnumObjects(DatabaseObjectTypes)

Enumerates a list of objects in the database.

public:
 System::Data::DataTable ^ EnumObjects(Microsoft::SqlServer::Management::Smo::DatabaseObjectTypes types);
public System.Data.DataTable EnumObjects (Microsoft.SqlServer.Management.Smo.DatabaseObjectTypes types);
Public Function EnumObjects (types As DatabaseObjectTypes) As DataTable
Parameters
types
DatabaseObjectTypes DatabaseObjectTypes DatabaseObjectTypes

A DatabaseObjectTypes object that limits the object types in the returned list.

Returns

A DataTable object value that contains a list of objects in the database. The table describes the different columns of the returned DataTable.

Column
Data type
Description.
DatabaseObjectTypes
String The type of database object. See DatabaseObjectTypes enumeration.
Schema
String The schema associated with the referenced object.
Name
String The name of the referenced object.
Urn
String The URN string that represents the referenced object.

Examples

The example runs a Server object enumeration method, but extracting the information from the <xref:System.DataTable> object is the same for Database enumeration methods.

VB

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  

$d = new-object System.Data.Datatable  
$d = $srv.EnumCollations  

Foreach ($r in $d.Rows)  
{  
   Write-Host "============================================"  
   Foreach ($c in $d.Columns)  
   {  
      Write-Host $c.ColumnName "=" $r[$c]  
   }  
}  

EnumObjects(DatabaseObjectTypes, SortOrder) EnumObjects(DatabaseObjectTypes, SortOrder) EnumObjects(DatabaseObjectTypes, SortOrder)

Enumerates a list of objects in the database.

public:
 System::Data::DataTable ^ EnumObjects(Microsoft::SqlServer::Management::Smo::DatabaseObjectTypes types, Microsoft::SqlServer::Management::Smo::SortOrder order);
public System.Data.DataTable EnumObjects (Microsoft.SqlServer.Management.Smo.DatabaseObjectTypes types, Microsoft.SqlServer.Management.Smo.SortOrder order);
Public Function EnumObjects (types As DatabaseObjectTypes, order As SortOrder) As DataTable
Parameters
types
DatabaseObjectTypes DatabaseObjectTypes DatabaseObjectTypes

A DatabaseObjectTypes object that limits the object types in the returned list.

order
SortOrder SortOrder SortOrder

A SortOrder object value that specifies the way in which to order the returned list of objects.

Returns

A DataTable object value that contains a list of objects in the database. The table describes the different columns of the returned DataTable.

Column
Data type
Description.
DatabaseObjectTypes
String The type of database object. See DatabaseObjectTypes enumeration.
Schema
String The schema associated with the referenced object.
Name
String The name of the referenced object.
Urn
String The URN string that represents the referenced object.

Examples

The example runs a Server object enumeration method, but extracting the information from the <xref:System.DataTable> object is the same for Database enumeration methods.

VB

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  

$d = new-object System.Data.Datatable  
$d = $srv.EnumCollations  

Foreach ($r in $d.Rows)  
{  
   Write-Host "============================================"  
   Foreach ($c in $d.Columns)  
   {  
      Write-Host $c.ColumnName "=" $r[$c]  
   }  
}  

Applies to