Reputation: 34251
I want to extract a subset of a database and copy to another server/database. Is it possible to copy/backup a single filegroup from one database and attach/restore to another?
Upvotes: 4
Views: 2124
Reputation:
Use the faithful "SELECT * FROM old_db.old_tbl INTO new_db.new_tbl" for each table.
Upvotes: 0
Reputation: 294287
You cannot restore a filegroup into a different database. Any restore operation must go through the recovery phase when the log is replayed against the restored data files and a new database would have a log that does not match the restored filgroup, so the engine will reject the backup.
You cannot detach/attach filegroups either, detach and attach are not working at filegroup level, only at database level.
Nor can you cannot do a file copy/overwrite, when the database comes online the recovery process will detect the mismatch and declare the database corrupt.
Upvotes: 3