Detach Schema
DETACH SCHEMA removes a namespace, a schema with all of its documents, indexes, security policies and child schemas, from the database and moves its files to a folder. The folder can later be attached to this or another database with Attach Schema.
- The folder must not already exist.
- The statement waits for other transactions that are using the schema to finish.
- A failure never leaves a partially detached schema: the schema is unregistered before its files are moved, and is restored if the move fails.
- Requires an account that is a member of an administrator role, because the statement reads and writes folders on the server.
- Can't be used inside an explicit transaction, because moving files can't be undone by the transaction log.
- The folder can be a quoted string or a string variable. It must be an absolute path, and must not be inside the server's data or transaction folders.
- A folder path can't end with a backslash ('D:\Exports\'), because the backslash would escape the closing quote.
DETACH SCHEMA WordList:Translation TO 'D:\Exports\Translation'- Attach Schema
- Client (Schema.Detach)