Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. how to make a duplicate database with new name in SQL Server 2008

how to make a duplicate database with new name in SQL Server 2008

Scheduled Pinned Locked Moved Database
databasesql-serversysadmintutorial
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nvarunkumar
    wrote on last edited by
    #1

    i need to make a duplicate copy of an existing database with a new name in sql server and this has to be done using QUERY ONLY, i tried to take a backup and restore but that restores with the same name...

    S P 2 Replies Last reply
    0
    • N nvarunkumar

      i need to make a duplicate copy of an existing database with a new name in sql server and this has to be done using QUERY ONLY, i tried to take a backup and restore but that restores with the same name...

      S Offline
      S Offline
      Sandeep Mewara
      wrote on last edited by
      #2

      Look here: MSDN: How to: Restore a Database to a New Location and Name (Transact-SQL)[^]

      Sandeep Mewara [My last tip/trick]: Server side Delimiters in ASP.NET[^]

      N 1 Reply Last reply
      0
      • S Sandeep Mewara

        Look here: MSDN: How to: Restore a Database to a New Location and Name (Transact-SQL)[^]

        Sandeep Mewara [My last tip/trick]: Server side Delimiters in ASP.NET[^]

        N Offline
        N Offline
        nvarunkumar
        wrote on last edited by
        #3

        thank you that worked for an extent, but still finding a bit of problem when trying to restore the database from sql query using c# in asp .net

        N 1 Reply Last reply
        0
        • N nvarunkumar

          thank you that worked for an extent, but still finding a bit of problem when trying to restore the database from sql query using c# in asp .net

          N Offline
          N Offline
          nvarunkumar
          wrote on last edited by
          #4

          when i try to restore it says the mdf file location is in correct but when i try to run the same query in sql it works perfectly, any idea on what iam doing wrong.... also how do i know the logical name of the db, since i will be restoring it in the runtime i cant afford it to come randomly, when i tested sometimes it comes as master and mastlog and sometimes it comes as the db name i have backed up...

          1 Reply Last reply
          0
          • N nvarunkumar

            i need to make a duplicate copy of an existing database with a new name in sql server and this has to be done using QUERY ONLY, i tried to take a backup and restore but that restores with the same name...

            P Offline
            P Offline
            Paul Conrad
            wrote on last edited by
            #5

            nvarunkumar wrote:

            QUERY ONLY

            Why? That is a rather inefficient approach...

            "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

            N 1 Reply Last reply
            0
            • P Paul Conrad

              nvarunkumar wrote:

              QUERY ONLY

              Why? That is a rather inefficient approach...

              "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

              N Offline
              N Offline
              nvarunkumar
              wrote on last edited by
              #6

              because i have backup and restore at runtime in asp .net, so if i get the query i can put it in sqlcommand in asp...

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups