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. Duplicate a database

Duplicate a database

Scheduled Pinned Locked Moved Database
databasesql-serversysadminquestion
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.
  • O Offline
    O Offline
    OmegaSupreme
    wrote on last edited by
    #1

    I want to make a copy of my sql server 2000 database. I want all the tables, relationships, stored procedures, diagrams etc but none of the data . How can this be accomplished ? Try not! Do or do not, there is no try. - Master Yoda

    R R 2 Replies Last reply
    0
    • O OmegaSupreme

      I want to make a copy of my sql server 2000 database. I want all the tables, relationships, stored procedures, diagrams etc but none of the data . How can this be accomplished ? Try not! Do or do not, there is no try. - Master Yoda

      R Offline
      R Offline
      RichardGrimmer
      wrote on last edited by
      #2

      Script the database.... Open Enterprise manager, and navigate to the database in question. Right-click, all tasks, Generate SQL Script. In the new dlg, click Show All, and select0 Script All Objects. Click OK and tell it where to save it. This will generate a .sql file that can be run through Query Analyser / OSQL etc. that will create all entities in your database.. "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox

      O 1 Reply Last reply
      0
      • R RichardGrimmer

        Script the database.... Open Enterprise manager, and navigate to the database in question. Right-click, all tasks, Generate SQL Script. In the new dlg, click Show All, and select0 Script All Objects. Click OK and tell it where to save it. This will generate a .sql file that can be run through Query Analyser / OSQL etc. that will create all entities in your database.. "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox

        O Offline
        O Offline
        OmegaSupreme
        wrote on last edited by
        #3

        Cool trick, tried on Northwind and the 11,000 lines plus of sql generated a slew of 'Invalid object name' errors. Probably just needs more investigation on my part though :-O Thank you. Try not! Do or do not, there is no try. - Master Yoda

        R 1 Reply Last reply
        0
        • O OmegaSupreme

          Cool trick, tried on Northwind and the 11,000 lines plus of sql generated a slew of 'Invalid object name' errors. Probably just needs more investigation on my part though :-O Thank you. Try not! Do or do not, there is no try. - Master Yoda

          R Offline
          R Offline
          RichardGrimmer
          wrote on last edited by
          #4

          May possibly be because you (I assume) tried to restore it to the existing Northwind DB - the invalid object name ocurrs since you're trying to create duplicate objects IN_THE_SAME_DATABASE.... Again, from EM, navigate to the Databases node, right click, New Database. Configure the new DB, and in QA, select the name of the new DB in the drop down, or issue a "Use " as the first cmd. Then run the script, and should be OK... "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox

          O 1 Reply Last reply
          0
          • R RichardGrimmer

            May possibly be because you (I assume) tried to restore it to the existing Northwind DB - the invalid object name ocurrs since you're trying to create duplicate objects IN_THE_SAME_DATABASE.... Again, from EM, navigate to the Databases node, right click, New Database. Configure the new DB, and in QA, select the name of the new DB in the drop down, or issue a "Use " as the first cmd. Then run the script, and should be OK... "Now I guess I'll sit back and watch people misinterpret what I just said......" Christian Graus At The Soapbox

            O Offline
            O Offline
            OmegaSupreme
            wrote on last edited by
            #5

            You could possibly be right, I did create a new database and ran the script on it but I may have run the script twice. In any case it did work and all the tables are present and correct. Thanks for your help :-D Try not! Do or do not, there is no try. - Master Yoda

            1 Reply Last reply
            0
            • O OmegaSupreme

              I want to make a copy of my sql server 2000 database. I want all the tables, relationships, stored procedures, diagrams etc but none of the data . How can this be accomplished ? Try not! Do or do not, there is no try. - Master Yoda

              R Offline
              R Offline
              refugeees
              wrote on last edited by
              #6

              hehe, I see!!

              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