Attach Database

Attach a local database to a server instance.

Privileges

Normal

Input Parameters

Name Type Required Description
SQL Server String Yes The name of the server that is hosting SQL Server.
Database String Yes The name of the database.
Database MDF File String Yes The path to the MDF file for the target database.
Database Log File String Yes The path to the database log file.

Output Parameters

Name Type Description
Result Number Returns a success value of zero or any value other than zero to indicate failure.

Example Input Parameters

Name Type Required Example
SQL Server String Yes Localhost
Database String Yes SQLdev
Database MDF File String Yes C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\MSDBData.MDF
Database Log File String Yes C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\MSDBLog.LDF