SPContentDatabase.CreateUnattachedContentDatabase Method (SqlConnectionStringBuilder)

Creates a content database object, from the database with the specified connection string, without registering it in the configuration database of the farm.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

public static SPContentDatabase CreateUnattachedContentDatabase(
	SqlConnectionStringBuilder connection
)

Parameters

connection
Type: System.Data.SqlClient.SqlConnectionStringBuilder

A connection string to a content database.

Return Value

Type: Microsoft.SharePoint.Administration.SPContentDatabase
The content database.

ExceptionCondition
ArgumentNullException

The connection parameter is a null reference (Nothing in Visual Basic).

Typically, unattached content databases are used for data recovery scenarios and to get orphaned site collections and sites.

Show: