Copy a table from a DB to another DB

  • Hello everybody;

    I am here again, I want to copy a table Time.dbo from my DB WorksBI to a DB BusinessIntelligence, both are int he same machine and server.

    can help me?

    Cindy

  • brennendeliebe05 (6/9/2009)


    Hello everybody;

    I am here again, I want to copy a table Time.dbo from my DB WorksBI to a DB BusinessIntelligence, both are int he same machine and server.

    can help me?

    Cindy

    while in the BusinessIntelligence database, try

    SELECT * from WorksBI.dbo.Time --time is the name of the table, right?

    if that works, then simply

    SELECT *

    INTO Time --this will create the table "Time", on the currently connected server, instantly based on the data from the SQL

    from WorksBI.dbo.Time

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • I agree with Lowell - that's that best way, but keep in mind that you might fill your transaction log if it is a huge table.

    In any case, you might also want to create indexes on your new table, since SELECT * INTO does not do that.

    Paul

    - Paul

    http://paulpaivasql.blogspot.com/

  • helloooo..hehe I got it I wrote this:

    select * into DimTiempo1 from AdventureWorksDW.dbo.DimTime

    and now I got my new table full..hehe

    thanks a lot

    😛

  • glad it worked for you; you clearly grasped the concept once you got an example.

    way to go.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply