Import / Export database with SQL Server Server Management Studio

前端 未结 5 415
Happy的楠姐
Happy的楠姐 2020-11-29 16:58

I thought this would be trivial, but it isn\'t... I\'m sure there is a simple way to do it but I can\'t manage to find it. Shame on me.

I want to import/exp

5条回答
  •  迷失自我
    2020-11-29 17:10

    I wanted to share with you my solution to export a database with Microsoft SQL Server Management Studio.

    To Export your database

    1. Open a new request
    2. Copy paste this script
    DECLARE @BackupFile NVARCHAR(255);
    SET @BackupFile = 'c:\database-backup_2020.07.22.bak';
    PRINT @BackupFile;
    BACKUP DATABASE [%databaseName%] TO DISK = @BackupFile;
    

    Don't forget to replace %databaseName% with the name of the database you want to export.

    Note that this method gives a lighter file than from the menu.

    To import this file from SQL Server Management Studio. Don't forget to delete your database beforehand.

    1. Click restore database

    1. Add the backup file

    2. Validate

    Enjoy! :) :)

提交回复
热议问题