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

Posted on 2012-08-28
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

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

    Expert Comment

    If you have access to the servers you can always script the object and run the script in the new server.
    LVL 9

    Accepted Solution

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    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 …
    In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    761 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

    9 Experts available now in Live!

    Get 1:1 Help Now