transfering data from one database to another

  • I'm needing to copy all the records from one database to another for just one table. Both DB;s are int the same directory. Can this be done with T-SQL like (Excuse the rough SQL, but it's serving as pseudocoode really):

    INSERT INTO [SoftIT].[dbo].[tblBUlookup]

    [BU_ID_Rec],

    [CostCenter],

    [BusinessUnit]

    FROM

    SELECT * FROM [TrackIT].[dbo].[tblBUlookup]

  • The code you show looks good.

    INSERT INTO table_name

    (

    ID

    , FirstName

    , LastName

    )

    SELECT

    ID

    , FirstName

    , LastName

    FROM database.schema.table_name

    You could also use the import/export task within SQL Server Management Studio

    ______________________________
    AJ Mendo | @SQLAJ

  • Thanks this worked great!

    INSERT INTO [SoftIT].[dbo].[tblBUlookup]

    (

    [CostCenter],

    [BusinessUnit]

    )

    SELECT

    [CostCenter],

    [BusinessUnit]

    FROM [TrackIT].[dbo].[tblBUlookup]

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

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