[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 73
  • 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
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

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