Simplest way to copy table structure from one database to another?

Posted on 2012-08-28
Medium Priority
Last Modified: 2012-08-29
Sorry if this has been asked before. I'm just wondering what is the easiest way to copy table and structure (not necessarily data) from server1-database1 to another server2-database2?
Question by:intoxicated_curveball
LVL 83

Expert Comment

ID: 38341611
Programmatically? Or otherwise? SQL Server? I would restore the database with new name and delete the data.
LVL 13

Expert Comment

ID: 38341660
If you have access to the servers you can always script the object and run the script in the new server.

Accepted Solution

selva_kongu earned 2000 total points
ID: 38344337
The easiest way I found to copy table schema in sql server-

1.From SSMS right click the database name from which you want to copy schema.

2. And Go to "tasks"

3.Then Select "Generate Scripts"

Follow the steps,select from which database you want to create scripts.Select whatever table or stored procedure you need to copy.
You can generate a script in a file or in a new query editor window.

Use that script to create same table structure or stored procedure in another database

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

840 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