Script copy a table

  • hello everyone,

    At this moment i am working at denormalisation of a databases. I wanne copy some tables (definitions and values) from one database to another database. Is it posible to do it with only tsql on an easy way. I don't have unfortunaly DTS services that i can use.

    Any sugestions are wellcome.

    Kind regards

    Johan Van den Bosch

  • yes and very easy:

    SELECT * INTO DESTINATION_DATABASE.DBO.TABLE

    FROM SOURCE_DATABASE.DBO.TABLE;

    GO

    DESTINATION_DATABASE is your database where you want to put the table and you data of that table!

    SOURCE_DATABASE is your database where are the tables and the data that you want to copy!

    another warning is that DBO is the schema so you should check if you are working with that schema or you have your own schema in your databases!

    that's all!

    Dugi

    ============================================================
    SELECT YOUR PROBLEM FROM SSC.com WHERE PROBLEM DESCRIPTION =
    http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

  • ...or you can use Import/Export Data wizards ... if you want to working by clicking!

    if you have any problem ...we are here!

    Dugi

    ============================================================
    SELECT YOUR PROBLEM FROM SSC.com WHERE PROBLEM DESCRIPTION =
    http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

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