[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

How to create a database from existing database in another name

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
sivakugan
Asked:
sivakugan
3 Solutions
 
sunezapaCommented:
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
 
sunezapaCommented:
and for the script: What is the error?
0
 
Ephraim WangoyaCommented:

Use Management Studio

Right click on the database
Select All Tasks
Select Copy Database...
Follow the wizard
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
sventhanCommented:
0
 
ManSys UKCommented:
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
 
sivakuganAuthor Commented:
Thanks for answers
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now