• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 81
  • Last Modified:

How do i Copy All the Tables from One Database to Another in SQL Server?

Hi Experts,

We have created a new Database now want to move all the tables schema to the New Database , so is there any shortcut to do this on SQL Server.

Thanks in Advance
0
karthik80c
Asked:
karthik80c
  • 3
  • 2
  • 2
2 Solutions
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
If you have SQL Serer Data Tools (SSDT) available you can create a new database project, then do a schema compare between source db and empty target db, then execute all objects.  This will create the schema but not move any data.
0
 
karthik80cAuthor Commented:
sorry pal .I don't have the tool .can u give some query to do that and that would be great
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
There is no single T-SQL statement I know of to read schema from one database and copy it to another, other than to build a cursor with dynamic T-SQL to loop through all objects.
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
karthik80cAuthor Commented:
oh OK thanks . let me try with the tool
0
 
Pawan KumarDatabase ExpertCommented:
Take backup of the existing database and restore it where you need.
0
 
Pawan KumarDatabase ExpertCommented:
Or Generate a DB script for Schema Only and run on the new DB.


Steps

---

  • Right Click on Your Database --> Select Task-->Generate Script..
  • Select Next in Script Wizard.
  • Select Script Entire Database.
  • Choose Your File Name. and Finish.
  • Advanced - Schema Only
  • Now you can use your script file.
1
 
karthik80cAuthor Commented:
Thanks and Let me do this Pal
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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