Solved

How to create a database from existing database in another name

Posted on 2011-02-20
6
286 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
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:ewangoya
ewangoya earned 166 total points
ID: 34940035

Use Management Studio

Right click on the database
Select All Tasks
Select Copy Database...
Follow the wizard
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
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…

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now