Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2009
    Posts
    79

    Unanswered: How to create a Linked SQL table in Sql Database

    Hi All,

    I have a query, It may sound silly but I want to ask a question regarding creating a linked table in sql server database. Now when I say linked table I don't want you guys to get confused with my question so I would like to elaborate the same. For example I have following four tables in my sql database :
    1) 2009_DataQtr1
    2) 2009_DataQtr2
    3) 2009_DataQtr3
    4) 2009_DataQtr4

    Now above mentioned each quarter table contains around 10 lacs rows of data. Now my question is that can we create a fullyear table .i.e. 2009_DataFY by linking above tables to the same .i.e. in properties or somewhere else can we map all the quarter tables to the Fullyear table.

    Thanks a lot for your help in advance.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    A UNION view?

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Sep 2009
    Posts
    79

    How to create a Linked SQL table in Sql Database

    Hi Pat,

    Are you saying that I should write a query using "Union" function or you are trying to say that there is some feature in sql server where in I can get a union View in a new sql table of some existing sql tables without consolidating them or running any query ?..



    Thanks a lot for your help in advance.

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Code:
    CREATE VIEW [dbo].[2009_DataFY] AS
       SELECT *
          FROM [dbo].[2009_DataQtr1]
       UNION ALL SELECT *
          FROM [dbo].[2009_DataQtr2]
       UNION ALL SELECT *
          FROM [dbo].[2009_DataQtr3]
       UNION ALL SELECT *
          FROM [dbo].[2009_DataQtr4]
    GO
    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  5. #5
    Join Date
    Sep 2009
    Posts
    79

    How to create a Linked SQL table in Sql Database

    Hi Pat,

    Thanks a lot for your reply, It got created successfully can I use the view created in SQL VBA statement referring as a table.

    Thanks a lot for your help in advance.

  6. #6
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Try using the view and find out. You can definitely SELECT from the view as though it were a table. Read up on Using Partitioned Views in order to understand how to do INSERT, UPDATE, and DELETE operations.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

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