Copy SQL Table from 1 database to another

Posted on 2009-04-29
Last Modified: 2012-06-21
I added another database to my SQL 2005 server and need to copy some table from the old database, what is the easiest method to do so.   By the way, I use MS SQL Server management Studio to manage the tavles, views etc.
Question by:MarketingDrive
    LVL 1

    Accepted Solution

    Easiest method would be to use the Import Data function, this will allow you to copy tables, views etc...
    LVL 31

    Expert Comment

    yes, you can export and import wizard but if you wish to do it by T-SQL than here is the command.

    select * into db2..table1 from db1..table1 where>50
    LVL 31

    Expert Comment


    insert into db2..table1
    select * from db1..table1 where>50
    LVL 25

    Expert Comment

    Right-Click on the source database in SQL Management Studio and choose 'Tasks' and then Export Data. This will bring up a wizard that will guide you..
    LVL 1

    Expert Comment

    Hi MarketingDrive,

    I did the following to copy an existing table in our production db to our test db (on the same sql server, but in different databases):

    In your Microsoft SQL server Management Studio, open a 'new query' window.

    Past following in the window and edit the names between [ ]
    USE [targetDBname];SELECT * INTO [targetTable] FROM [sourceDB].dbo.[sourceTable]

    Hope this helps you.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
    by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    760 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

    8 Experts available now in Live!

    Get 1:1 Help Now