Copying data within the same database

  • Hi All,

    I have the 'sql script' below joining data from 6 tables from 'Tables A' , am trying to copy the result from 'sql script' into the tables in 'Table B' below, been trying to use import/export wizard, but having problems specifying the destination tables, can't get the option to specify this, its trying to create a new set of tables, but I already have the tables that I want to use (Tables B).

    Does anyone know how I can tackle this, alternativey if its better to use BIDS which am not very familiar with. Any suggestions would be highly appreciated.

    Sql script

    ----------------

    SELECT * FROM recent_student RS

    JOIN

    recent_student_graduate_2330 SG2 ON RS.individual_id = SG2.individual_id

    LEFT JOIN

    recent_student_professional SP ON RS.individual_id = SP.individual_id

    JOIN

    recent_individual RI ON RS.individual_id = RI.individual_id

    JOIN

    recent_student_graduate RSG ON RS.individual_id = RSG.individual_id

    JOIN

    recent_student_organisation RSO ON RS.individual_id = RSO.individual_id

    WHERE

    RS.individual_id = 10734589;

    Tables A

    --------------

    dbo.recent_student

    dbo.recent_student_graduate_2330

    dbo.recent_student_professional

    dbo.recent_individual

    dbo.recent_student_graduate

    dbo.recent_student_organisation

    Tables B

    --------------

    dbo.student

    dbo.student_graduate_2330

    dbo.student_professional

    dbo.individual

    dbo.student_graduate

    dbo.student_organisation

  • You don't need SSIS of bids to do this.

    Also, your query above will not move the data from the source tables into new tables but rather from your source to a single destination

    If all you want to do is copy the data for a certain individual(s) run seomthing along the lines of

    insert into mynewtable (MyCol1, MyCol2 etc)

    Select (MyCol1, MyCol2 etc from MyOriginaltable where individualID= 12345

    You need to do that to each table. There is no way to move data between tables the way you are trying...

    HTH

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!

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

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