sys.sp_attach_db

general
#stored-procedure

Description

Attaches a database to a server. Don’t attach or restore databases from unknown or untrusted sources. Such databases could contain malicious code that might execute unintended Transact-SQL code or cause errors by modifying the schema or the physical database structure.

Syntax

CREATE DATABASE <database_name> FOR ATTACH