Solved

How to create a database from existing database in another name

Posted on 2011-02-20
6
297 Views
Last Modified: 2012-06-21
Hi,
I have one database called KalasamDB in my SQL Server . I want to create another database as the same as KalasamDB with another name. Therefore I have done like this, Scrict database as -Create TO - New Query Editor Window. Then I have find and replaced all the names of KalasamDB into KnowledgebaseDB. But its giving me an error.
I have also changed the path but I couldn't figure out the problem here.

Can anyone help me plzz?

---------------------------------------------------------------------------------------------------------------------
0
Comment
Question by:sivakugan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Assisted Solution

by:sunezapa
sunezapa earned 167 total points
ID: 34939880
I would make a backup to file, rename the existing database and restore the backupfile, maybe have a look on the option to change the SQL-filenames.
quick and easy - if you have access to the server, of course...
0
 
LVL 3

Expert Comment

by:sunezapa
ID: 34939882
and for the script: What is the error?
0
 
LVL 32

Assisted Solution

by:Ephraim Wangoya
Ephraim Wangoya earned 166 total points
ID: 34940035

Use Management Studio

Right click on the database
Select All Tasks
Select Copy Database...
Follow the wizard
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 18

Expert Comment

by:sventhan
ID: 34942875
0
 

Accepted Solution

by:
ManSys UK earned 167 total points
ID: 34949337
I'm assuming you don't want the data copied, which is why you've scripted it so the chances are it's trying to save the MDF and LDF files over the existing KALASMDB files (because they're not called KALASAMDB.mdf?).  I would find ".mdf" and make sure that file does not exist, also same for ".ldf".

If you're trying to do an exact copy, i.e. data too, then backup / restore is the best option as others have said here.
0
 

Author Comment

by:sivakugan
ID: 35134207
Thanks for answers
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question