Copy DataBase

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • baburk
    New Member
    • Oct 2006
    • 111

    Copy DataBase

    How to copy an entire database to another database.

    insert into NewTable from select * from oldTable

    This copy entire contents from oldTable to NewTable.

    Is there is any query to copy a datable contents like this.

    Thanks

    Babu.R.K
  • VijaySofist
    New Member
    • Jun 2007
    • 107

    #2
    Originally posted by baburk
    How to copy an entire database to another database.

    insert into NewTable from select * from oldTable

    This copy entire contents from oldTable to NewTable.

    Is there is any query to copy a datable contents like this.

    Thanks

    Babu.R.K
    Hi Babu!

    Do you want to copy the full database contents to other database through manually or using some query?

    If you want manually means, you can use Enterprise Manager.
    Open the Enterprise Manager by Select Programs->Microsoft SQL Server->Enterprise Manager,
    Select your SQL Server,
    Select the Source Database
    Select All the tables and copy those tables
    Select your Destination DataBase and Click paste

    Now All the tables and its values will be present in your new Database

    All The Best

    With Regards
    Vijay. R

    Comment

    • baburk
      New Member
      • Oct 2006
      • 111

      #3
      Hi I want it only in QUERY

      Comment

      • camel
        New Member
        • Jan 2008
        • 55

        #4
        Write an SP that uses Restore Database...With Move from a backup of the old database to create an exact copy of the database on the same server ? Or maybe take copy of detached mdf file and the use sp_attach with new db name

        If you are looking to copy the whole of anything but a very small database reliably to another database you would be best looking at a file based approach Trying to use SELECT..INTO, Bulk Insert or even DTS for a whole database just won't guarantee to get all the metadata copied properly, e.g., table constraints, User rights, Roles, etc.

        Comment

        Working...