Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2011
    Location
    Corpus Christi, TX
    Posts
    26

    Unanswered: Combining Table Question

    Hello. I am not a database person, but quite often use Access to process large amounts of information. Im currently working a large project with millions of records so I'm using SQL Server 2008.

    I just exported 5 tables from access over to SQL Server. How can I combine these tables into one?
    Last edited by justchillin; 10-30-11 at 17:04.

  2. #2
    Join Date
    Jun 2010
    Posts
    28
    Quote Originally Posted by justchillin View Post
    Hello. I am not a database person, but quite often use Access to process large amounts of information. Im currently working a large project with millions of records so I'm using SQL Server 2008.

    I just exported 5 tables from access over to SQL Server. How can I combine these tables into one?
    The structure of the table need to be the same

    Code:
    INSERT INTO [which_table_to]
    SELECT * FROM [which_table_from]

  3. #3
    Join Date
    Oct 2011
    Location
    Corpus Christi, TX
    Posts
    26
    Would it look like this if I want to merge the 2008, 2009,2010, and 2011 table into 2007?

    INSERT INTO [PRODUCTION 2007SQL].[dbo].[2007]
    SELECT * FROM [PRODUCTION 2008-2009SQL].[dbo].[2008]
    SELECT * FROM [PRODUCTION 2008-2009SQL].[dbo].[2009]
    SELECT * FROM [PRODUCTION 2010-2011SQL].[dbo].[2010]
    SELECT * FROM [PRODUCTION 2010-2011SQL].[dbo].[2011]



    Quote Originally Posted by shamas21 View Post
    The structure of the table need to be the same

    Code:
    INSERT INTO [which_table_to]
    SELECT * FROM [which_table_from]

  4. #4
    Join Date
    Jun 2010
    Posts
    28
    Quote Originally Posted by justchillin View Post
    Would it look like this if I want to merge the 2008, 2009,2010, and 2011 table into 2007?

    INSERT INTO [PRODUCTION 2007SQL].[dbo].[2007]
    SELECT * FROM [PRODUCTION 2008-2009SQL].[dbo].[2008]
    SELECT * FROM [PRODUCTION 2008-2009SQL].[dbo].[2009]
    SELECT * FROM [PRODUCTION 2010-2011SQL].[dbo].[2010]
    SELECT * FROM [PRODUCTION 2010-2011SQL].[dbo].[2011]


    Code:
    INSERT INTO [PRODUCTION 2007SQL].[dbo].[2007]
    SELECT * FROM [PRODUCTION 2008-2009SQL].[dbo].[2008]
    UNION ALL
    SELECT * FROM [PRODUCTION 2008-2009SQL].[dbo].[2009]
    UNION ALL
    SELECT * FROM [PRODUCTION 2010-2011SQL].[dbo].[2010]
    UNION ALL
    SELECT * FROM [PRODUCTION 2010-2011SQL].[dbo].[2011]

  5. #5
    Join Date
    Oct 2011
    Location
    Corpus Christi, TX
    Posts
    26
    Thanks for your help. Worked like a charm.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •