How to copy a sql server database to disk

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nairdeepthi2000
    New Member
    • Apr 2007
    • 12

    How to copy a sql server database to disk

    Hi friends

    I want to copy a sql server database to my pendrive but i am not able to just copy paste it, I m using sql server first time so have no idea about it

    Pleez help me out
  • iburyak
    Recognized Expert Top Contributor
    • Nov 2006
    • 1016

    #2
    You have to be able to do Backup and then Restore where ever you want this database to go:


    [PHP]
    A. Back up the entire MyNwind database


    Note The MyNwind database is shown for illustration only.


    This example creates a logical backup device in which a full backup of the MyNwind database is placed.

    -- Create a logical backup device for the full MyNwind backup.
    USE master
    EXEC sp_addumpdevice 'disk', 'MyNwind_1',
    DISK ='c:\Program Files\Microsoft SQL Server\MSSQL\BA CKUP\MyNwind_1. dat'

    -- Back up the full MyNwind database.
    BACKUP DATABASE MyNwind TO MyNwind_1[/PHP]

    [PHP]
    A. Restore a full database


    Note The MyNwind database is shown for illustration.


    This example restores a full database backup.

    RESTORE DATABASE MyNwind
    FROM MyNwind_1[/PHP]

    Good Luck.

    Comment

    Working...